selenium安裝問題整理

錯誤代碼以下:python

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

self.service.start()github

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

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

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

 

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

 

Windows系統解決辦法以下:cmd

一、下載geckodriver.exe:selenium

下載地址:https://github.com/mozilla/geckodriver/releasesit

請根據系統版本選擇下載;(如Windows 64位系統)

 

二、下載解壓後將getckodriver.exe複製到Firefox的安裝目錄下,如(C:\Program Files\Mozilla Firefox),並在環境變量Path中添加路徑:C:\Program Files\Mozilla Firefox;

 

3.重啓cmd或IDLE再次運行代碼便可

相關文章
相關標籤/搜索