Skip to content
Advertisement

Expected browser binary location, but unable to find binary in default location, no ‘moz:firefoxOptions.binary’ capability provided

I am trying to get back into using Python Webdriver. I have here the code

JavaScript

This causes:

JavaScript

If I try:

JavaScript

I get

JavaScript

Geckodriver.exe is sitting right there in the downloads folder.

enter image description here

Advertisement

Answer

This error message…

JavaScript

…implies that the GeckoDriver was unable to locate the executable while trying to initiate/spawn a new Browsing Context i.e. Firefox Browser session.


Reason

The two primary reasons for this error are as follows:

  • Firefox isn’t installed within your system.
  • Firefox isn’t installed at the default location within your system.

Solution

The possible solutions are:

  • If Firefox isn’t installed in your system, you need to install it before executing your tests.

  • If Firefox is installed at a customized location, you need to pass the absolute path of the firefox binary as follows through an Options() instance:

    JavaScript

References

You can find a couple of relevant detailed discussion in:

Advertisement