7

I am using selenium to test our websites. When I build the project, there is an Exception :-

OpenQA.Selenium.WebDriverException: Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055 and the problem is from the code

IWebDriver driver = new FirefoxDriver();

Anybody knows how to solve this problem?

Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73
Terry Zhang
  • 4,541
  • 8
  • 23
  • 29

2 Answers2

2

Just like the other drivers available to Selenium from other browser vendors, Mozilla has released an executable that will run alongside the browser.

You can download the latest executable geckodriver from here

Add downloaded executable geckodriver to system path

The Selenium client bindings will try to locate the geckodriver (or wires) executable from the system path. You will need to add the directory containing the executable to the system path.

  • On Unix systems you can do the following to append it to your system’s search path, if you’re using a bash-compatible shell:

    export PATH=$PATH:/path/to/directory/of/executable/downloaded/in/previous/step
    
  • On Windows you need to update the Path system variable to add the full directory path to the executable geckodriver. The principle is the same as on Unix.

After all above stuff you need to Initialize FireFoxDriver as below :-

var driver = new FirefoxDriver(new FirefoxOptions());

Note :- Follow this link for the solution of this problem with other programming language.

Community
  • 1
  • 1
Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73
  • I'm using selenium via capybara - and I'm not sure where I would add that FireFoxDriver initialization ... – Sam Joseph Aug 31 '16 at 11:11
  • @SamJoseph Follow this link http://stackoverflow.com/questions/37757040/configure-capybara-to-use-marionette-webdriver-for-firefox – Saurabh Gaur Aug 31 '16 at 11:42
  • 1
    Warning about gecko, at the time of writing this v0.11.1 is the latest release and is not very stable. I'm sure it will get better in time but in the near future it would be wise to consider @Ajeets suggestion below as an alternative. – Sean Tomlins Oct 20 '16 at 14:15
  • Same here: geckodriver very unstable, got problems like 'permission denied to access property ...' while using Display property of a WebElement and other problems. Had to revert back to 2.5.31 and FF 45 ESR. – Eulinky Nov 03 '16 at 18:34
2

This answer didn't worked with me. Running selenium 2.53.6 and firefox 47 n 48.

I would recommend downloading firefox 46 which seems to be the best match for selenium 2.53.x.

https://ftp.mozilla.org/pub/firefox/releases/46.0.1/win64/en-US/

Once I downgraded to firefox 46.0.1 everything was working as expected.

Ajeet
  • 892
  • 1
  • 9
  • 22