为了账号安全,请及时绑定邮箱和手机立即绑定

geckodriver

geckodriver

至尊宝的传说 2019-05-25 13:37:22
macOSselenium3.4python3sublimetext3web开发测试驱动方法第四页第一个功能测试functional_tests.pyfromseleniumimportwebdriverbrowser=webdriver.Firefox()browser.get('http://localhost:8000')assert'Django'inbrowser.title报错Traceback(mostrecentcalllast):File"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/common/service.py",line74,instartstdout=self.log_file,stderr=self.log_file)File"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",line707,ininitrestore_signals,start_new_session)File"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py",line1333,in_execute_childraisechild_exception_type(errno_num,err_msg)FileNotFoundError:[Errno2]Nosuchfileordirectory:'geckodriver'Duringhandlingoftheaboveexception,anotherexceptionoccurred:Traceback(mostrecentcalllast):File"/Users/Frankyan360/Documents/web_test/functional_tests.py",line3,inbrowser=webdriver.Firefox()File"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py",line142,ininitself.service.start()File"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/common/service.py",line81,instartos.path.basename(self.path),self.start_error_message)selenium.common.exceptions.WebDriverException:Message:'geckodriver'executableneedstobeinPATH.[Finishedin0.2swithexitcode1][cmd:['/usr/local/bin/python3','-u','/Users/Frankyan360/Documents/web_test/functional_tests.py']][dir:/Users/Frankyan360/Documents/web_test][path:/usr/bin:/bin:/usr/sbin:/sbin]不知道哪里出问题了
查看完整描述

2 回答

?
慕森卡

TA贡献1806条经验 获得超8个赞

'geckodriver'executableneedstobeinPATH.是说你这个东西应该有个可执行的程序,要添加到PATH里,就是要把geckodriver的位置添加到系统环境变量里,或者你在usr/bin下建立一个软连接
                            
查看完整回答
反对 回复 2019-05-25
?
神不在的星期二

TA贡献1963条经验 获得超6个赞

首先先确定你selenium的版本,2.53.0之前直接安装selenium是没有问题的,另外再看下你Firefox的版本,在版本45之后会使用新的geckodriver驱动才能使用。最好使用最新版本的selenium以便减少错误。
                            
查看完整回答
反对 回复 2019-05-25
  • 2 回答
  • 0 关注
  • 628 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号