由於安裝了最近的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