搭建 Selenium自动化测试环境:Selenium+Python 运行了一个测试脚本,出现以下错误。求解
Traceback(mostrecentcalllast):File"C:\Users\Administrator.SC-201607151621\AppData\Loc...
Traceback (most recent call last):
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Administrator.SC-201607151621/AppData/Local/Programs/Python/Python35/2.py", line 4, in <module>
driver = webdriver.Firefox()
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 140, in __init__
self.service.start()
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 展开
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 1224, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Administrator.SC-201607151621/AppData/Local/Programs/Python/Python35/2.py", line 4, in <module>
driver = webdriver.Firefox()
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 140, in __init__
self.service.start()
File "C:\Users\Administrator.SC-201607151621\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 展开
2017-02-22
展开全部
去搜索下载geckodriver.exe 放到C:\Python27\Scripts目录下
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询