51Testing软件测试论坛

标题: selenium3.3.1+python3.6.1+firefox53.0 第一个程序就出错了 [打印本页]

作者: virginia_shi    时间: 2017-4-25 14:58
标题: selenium3.3.1+python3.6.1+firefox53.0 第一个程序就出错了
刚开始自学运行第一个程序就报错了
PATH环境变量:
C:\Python36\Scripts\;C:\Python36\;%TTPRO_APPDIR%;%TTPRO_64BITLIBS_1%;C:\Program Files\Mozilla Firefox;C:\Python36\dev\geckodriver-v0.15.0-win64

geckodriver已经放置在这个目录下面了
C:\Python36\dev\geckodriver-v0.15.0-win64

>>> driver=webdriver.Firefox()
Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Python36\lib\subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "C:\Python36\lib\subprocess.py", line 990, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#113>", line 1, in <module>
    driver=webdriver.Firefox()
  File "C:\Python36\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 145, in __init__
    self.service.start()
  File "C:\Python36\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.


是不是selenium和firefox版本不兼容?
作者: virginia_shi    时间: 2017-4-25 16:47
找到原因了。。。。 配置环境变量之后没有重启python IDE
作者: 梦想家    时间: 2017-4-26 09:05

作者: 清晨一缕阳光    时间: 2017-4-26 11:17
很不错,自己能够找到问题,解决问题!距离大神不远了。




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2