您的位置:首页 > 编程语言 > Python开发

python selenium模块使用出错解决,Message: 'geckodriver' executable needs to be in PATH

2016-12-02 19:06 946 查看
错误代码如下:

File "/usr/local/lib/python2.7/dist-packages/selenium-3.0.0b2-py2.7.egg/selenium/webdriver/firefox/webdriver.py", line 65, in __init__

self.service.start()

File "/usr/local/lib/python2.7/dist-packages/selenium-3.0.0b2-py2.7.egg/selenium/webdriver/common/service.py", line 71, in start

os.path.basename(self.path), self.start_error_message)

selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.firefox.service.Service object at 0x7f753ad53390>> ignored

Windows系统解决办法如下:

1、下载geckodriver.exe:

下载地址:https://github.com/mozilla/geckodriver/releases

请根据系统版本选择下载;(如Windows 64位系统)

2、下载解压后将getckodriver.exe复制到Firefox的安装目录下,如(C:\Program Files\Mozilla Firefox),并在环境变量Path中添加路径:C:\Program Files\Mozilla Firefox;

3.重启cmd或IDLE再次运行代码即可

ubuntu16.04环境下 解决方法:

1、下载 geckodriverckod 地址: https://github.com/mozilla/geckodriver/releases
2、解压后将geckodriverckod 存放至 /usr/local/bin/ 路径下即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  selenium python
相关文章推荐