我对火狐47版有这个问题https://github.com/seleniumhq/selenium/issues/2110
所以,我试图添加木偶网络驱动程序来修复它:https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
但是:
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '/Users/myproject/geckodriver-0.8.0-OSX'
返回错误:
selenium.common.exceptions.WebDriverException: Message: 'wires' executable needs to be in PATH.
Exception AttributeError: "'Service' object has no attribute 'process'" in > ignored
硒=2.53.5
我可以确认ran into this issue应该指向Firefox二进制文件,而不是GeckoDriver。关于这个主题,Mozilla WebDriver documentation中的Python示例已经阐明。
除了其他两个答案之外,您可能不想更改系统范围内的
PATH
,因为您只在运行测试时需要它。只有在需要时才有权使用PATH
的方法是在代码中设置它:一个更简单的解决方法是简单地将
geckodriver
二进制文件移动到路径中已有的目录:您设置的firefox二进制功能指向的是firefox二进制文件,而不是木偶驱动程序二进制文件。您需要将
/Users/myproject/geckodriver-0.8.0-OSX
添加到路径中,如下所示:打开终端并运行此命令
相关问题 更多 >
编程相关推荐