2

Exception stack trace:

OpenQA.Selenium.WebDriverException: Failed to start up socket within 45000 ms. Attempted to connect to the following addresses: 127.0.0.1:7055 at OpenQA.Selenium.Firefox.FirefoxDriverServer.ConnectToBrowser(TimeSpan timeToWait) at OpenQA.Selenium.Firefox.FirefoxDriverServer.Start() at OpenQA.Selenium.Firefox.FirefoxDriverCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary'2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at DtvAutomation.Selenium.Api.SeleniumFirefoxTest.CreateWebDriver() at DtvAutomation.Selenium.Api.SeleniumTest'1.Run()

The code that throws the exception is calling the Firefox WebDriver constructor:

protected override FirefoxDriver CreateWebDriver()
{
    lock(this.syncRoot)
    {
        var ffBinary = new FirefoxBinary();
        var ffProfile = new FirefoxProfile();
        return new FirefoxDriver(
            binary: ffBinary,
            profile: ffProfile,
            commandTimeout: TimeSpan.FromMinutes(2));
    }
}

I am using selenium 2.46 (via NuGet package) from a Visual Studio 2013 - "WCF Application Service" project. Firefox is 38.0.5 (latest). When I start the WCF from Visual Studio (debug mode) everything works fine - no exceptions. When I publish the WCF to local IIS it throws this error.

I tried the following things:

  • Updated NuGet packages - make sure I'm up-to-date
  • Downgraded Firefox to version 34.0.5
  • Upgraded Firefox to latest version
  • Opened port 7055 from firewall
  • Change credentials for IIS application / app-pool, used the Administrator account
  • On exception, re-try to initialize WebDriver using another port

None of these seem to work. Any ideas what could be the problem?

Florin Lazar
  • 21
  • 1
  • 3

4 Answers4

1

I had the same issue. Changing the app pool identity to something like LocalSystem solved the issue, but you don't want to do that in production.

Instead I found a setting, LoadUserProfile, on the Application Pool's Advanced Settings, that was set to False. If you set it to True, the application pool loads a user profile which in turn gets rid of the Selenium issue.

You need to run at least IIS 7, and you can read more about the setting here.

lasseschou
  • 1,550
  • 15
  • 24
  • @Elmue the OP asked a question about Firefox WebDriver run through WCF/IIS. If you have something constructive to add, please do. – lasseschou Mar 07 '16 at 20:18
0

I had the same problem, the solution was to switch app pool identity from "ApplicationPoolIdentity" to more powerful user.

Oleg Gliznutsa
  • 177
  • 1
  • 8
0

I just faced a similar issue. I was using Selenium Webdriver Nuget Package v2.48 Firefox version 41.0

Initially, thinking that it was an issue with a version conflict between FF and Webdriver, I upgraded Webdriver to this version. Nothing fixed. Next, I downgraded FF to v 31.0. Nothing fixed. Third, I thought about what was a recent change, and it was this line of code for me

p.SetPreference("webdriver.log.file", "/tmp/firefox_console");

Within this block of code

            FirefoxProfile p = new FirefoxProfile();
            //p.SetPreference("webdriver.log.file", "/tmp/firefox_console");
            //p.SetPreference("dom.ipc.plugins.flash.disable-protected-mode", true);
            driver = new FirefoxDriver(p);
            driver.Manage().Window.Maximize();

After commenting out the SetPreference method = Success! Firefox was opening as expected.

Nikolay Advolodkin
  • 1,820
  • 2
  • 24
  • 28
-1

I think problem state with timeout of firefox webdriver. You can do with following which include Firefox profile and TimeSpan which may reduced timeout of Firefox web driver.

IWebDriver driver = new FirefoxDriver(new FirefoxBinary(), 
                                      new FirefoxProfile(), 
                                      TimeSpan.FromSeconds(180));
David Guyon
  • 2,759
  • 1
  • 28
  • 40