python selenium 3.0 - Firefox 47.0.1 installed in default location is not identified. (geckodriver)

半城伤御伤魂 提交于 2019-12-05 19:29:30
Prakriti Gupta

The reason for this error is that Python couldn't find the function FirefoxBinary directly.

I encountered a similar problem. Solved it by giving reference to the function:

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

Later found that the solution is already available here (indirectly).

Naveen Kumar R B

Restarting my machine solved the issue. (May be required if you keep the geckodriver.exe in one of the PATH locations.

Not sure if it was the real issue that needs to be solved, but one of the variable.


Little Background to geckodriver.exe and Firefox version support:

From geckodriver github page:

Firefox 47 is explicitly not supported

So, If you want to use Firefox 47.0.1 version, use Firefox driver but not geckodriver.

  1. In case of selenium 2.53, you don't need to do any additional things (no need to setup geckodriver as selenium 2.53 uses Firefox driver by default).
  2. In Selenium 3.0, we must set geckodriver path (as geckodriver is the default driver for Firefox in Selenium 3.0) using System.setProperty and set marionette to false, so geckodriver capabilities will be disabled and default Firefox driver is used.

example code:

System.setProperty("webdriver.gecko.driver", "path/to/geckodriver.exe");
DesiredCapabilities d = new DesiredCapabilities();
d.setCapability("marionette", false);  // to disable marionette, by default true
WebDriver driver = new FirefoxDriver(d);

References:

  1. https://github.com/mozilla/geckodriver#supported-firefoxen
  2. https://github.com/mozilla/geckodriver/issues/224
  3. https://stackoverflow.com/a/40658421/2575259
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!