selenium3下打不開Firefox報錯解決


由於安裝了最近的selenium3,導致之前正常運行的firefox失敗了

報錯信息:

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 0x00000000024C6278>> ignored

我也不知道為啥百度原因如下

因為最新的selenium3 需要用geckodriver 來驅動,不再使用Seleniu默認自帶的Firefox webdriver。

我們只需要在下面這個地址下載 geckodriver 並將 其所在的路徑設為環境變量即可解決。

https://github.com/mozilla/geckodriver/releases

然后再次運行 有報錯了。。。。阿西吧

selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

再次百度。。。。發現需要指定下Firefox的地址 在path 環境下 加上Firefox的路徑即可 C:\Program Files (x86)\Mozilla Firefox


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM