由于安装了最近的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