2

I'm trying to use Selenium in C# and I get the following error,

System.InvalidOperationException: '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 (SessionNotCreated)'

what could it be?

4

2 Answers 2

2

This error message...

System.InvalidOperationException: '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 (SessionNotCreated)'

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

Possibly browser is installed at a non-conventional location, hence GeckoDriver is unable to access the firefox binary.


Solution

As a solution pass the absolute location of the firefox.exe binary through the BrowserExecutableLocation argument of FirefoxOptions as follows:

FirefoxOptions options = new FirefoxOptions();
options.BrowserExecutableLocation = ("C:\\Program Files\\Mozilla Firefox\\firefox.exe"); //location where Firefox is installed
WebDriver driver = new FirefoxDriver(options);
Sign up to request clarification or add additional context in comments.

Comments

0

You need download Mozilla Firefox

https://www.mozilla.org/en-US/firefox/new/

then install Mozilla Firefox.

4 Comments

i download selenium firefox , i want open tor with selenium
Did you install Firefox in default location?
i have tor browser in my desktop. yes i have firefox

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.