Selenium install Marionette webdriver

落爺英雄遲暮 提交于 2019-12-01 14:17:01

问题


I have this issue with firefox version 47 https://github.com/seleniumhq/selenium/issues/2110

So, i have tried to add Marionette web driver to fix it: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

But:

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'

returns error:

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

Exception AttributeError: "'Service' object has no attribute 'process'" in > ignored

selenium==2.53.5


回答1:


the firefox binary capability you're setting points to the firefox binary, not the marionette driver binary. You need to add /Users/myproject/geckodriver-0.8.0-OSX to your path as follows:

Open a terminal and run this command

export PATH=$PATH:/Users/myproject/geckodriver-0.8.0-OSX



回答2:


I ran into this issue and can confirm that firefox_capabilities['binary'] should point to the Firefox binary, not to GeckoDriver. The Python example in the Mozilla WebDriver documentation has been clarified on this topic.




回答3:


In addition to the other two answers, you probably don't want to change the PATH system wide since you need it only when running the tests. A way to have the right PATH only when you need it is to set it in code:

os.environ["PATH"] += os.pathsep + 'path/to/dir/containing/geckodriver/'

A simpler workaround would be to simple move the geckodriver binary to the directory you already have in your path:

mv geckodriver /usr/local/bin


来源:https://stackoverflow.com/questions/37808643/selenium-install-marionette-webdriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!