Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to start up socket within 45000

I'm using FF version 19

it was all working fine till yesterday and suddenly today morning i start getting this error and i have the same exact code that was running before, no change nothing

error message:

Test 'M:.TestCases.12' failed: Failed to start up socket within 45000
    OpenQA.Selenium.WebDriverException: Failed to start up socket within 45000
    at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.ConnectToBrowser(Int64 timeToWaitInMilliSeconds)
    at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Start()
    at OpenQA.Selenium.Firefox.FirefoxDriver.StartClient()
    at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
    at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
    at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile)
    at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxProfile profile)

0 passed, 1 failed, 0 skipped, took 145.80 seconds (Ad hoc).

here is my source code:

public static IWebDriver GetDriver()
        {
            switch (Common.BrowserSelected)
            {
                case "ff":
                    FirefoxProfile profile = new FirefoxProfile();
                    profile.SetPreference("network.http.phishy-userpass-length", 255);
                    profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", url);
                    drv = new FirefoxDriver(profile);
                    break;
                case "ie":
                    var options = new InternetExplorerOptions();
                    options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                    DesiredCapabilities capabilities = new DesiredCapabilities();
                    capabilities.SetCapability(CapabilityType.AcceptSslCertificates, true);
                    drv = new InternetExplorerDriver(options);
                    break;
                case "chrome":
                    //_driver = new ChromeDriver();
                    break;
            }
            return drv;
        }
like image 429
Nick Kahn Avatar asked Mar 06 '13 14:03

Nick Kahn


3 Answers

Firefox 19 'support' was added in Selenium's latest versions. So since you are using .NET, the direct download for the latest at the time of this post is version 2.31.2:

selenium-release.storage.googleapis.com/index.html

like image 114
Arran Avatar answered Nov 19 '22 11:11

Arran


I have this issue with Firefox 43 and Selenium 2.48. It happens when your Selenium driver server is running in a 32 bit process and you start the 64 bit version of Firefox.

The cause is that the webdriver server tries to connect to port 7055 which should be opened by the webdriver that runs in the Firefox executable. But you can see in TcpView from www.sysinternals.com that Firefox does not open this port. So the driver waits until his timeout (45 seconds) elapses.

This happens even after turning off the Windows Firewall completely.

All posts that I found in internet do NOT help: Upgrade Selenium, downgrade Firefox, etc..

But after installing the 32 bit version of the same Firefox 43 it works. I see in TcpView how Firefox 32 bit opens the port correctly:

Firefox Selenium webdriver Port 7055

In my code I use

FirefoxProfile Prof = new FirefoxProfile();
FirefoxBinary  Bin  = new FirefoxBinary(sBrowserExe);
mDriver = new FirefoxDriver(Bin, Prof);

With sBrowserExe = "C:\Program Files\Mozilla Firefox 43\firefox.exe" the 64 bit version of Firefox 43 is started and I get the timeout exception.

With sBrowserExe = "C:\Program Files (x86)\Mozilla Firefox 43\firefox.exe" the 32 bit version of Firefox 43 is started and it works!


UPDATE: The developers from Firefox now broke Selenium support COMPLETELY. New Firefox versions from 48 upwards need a digital signature for all extensions to be installed.

https://wiki.mozilla.org/Addons/Extension_Signing

What I don't understand is why Selenium people cannot get a signature for the current Selenium driver??

Firefox version 47.0 has a bug that does not allow to use it with Selenium. This bug has been fixed in version 47.0.1.

Firefox versions from 48.0 and above do not install the old Selenium driver anymore. They must be automated with Marionette (= Gecko) driver.

The problem is that Marionette is still beta and has a lot of missing features so there is currently no solution to automate the new Firefox versions.

As you see here the new driver is full of bugs: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status

like image 36
Elmue Avatar answered Nov 19 '22 10:11

Elmue


If Upgrading Webdriver doesn't help you can downgrade FireFox that will solve issue.

like image 4
Andrian Durlestean Avatar answered Nov 19 '22 11:11

Andrian Durlestean