Selenium WebDriver - FirefoxDriver error: Failed to start up socket within 45000

后端 未结 17 2320
滥情空心
滥情空心 2020-12-01 13:03

I\'m getting this error:

tests.IntegrationTests.Selenium.RegisterAndLogin (TestFixtureSetUp):
SetUp : OpenQA.Selenium.WebDriverException : Failed to start up         


        
相关标签:
17条回答
  • 2020-12-01 13:33

    Reinstalling FF browser fixed the issue.

    0 讨论(0)
  • 2020-12-01 13:33

    I was working with on C# with WebDriver 2.53/Firefox 46. Tried reinstalling things, manually re-adding etc but downgrading Firefox to 43 fixed it for me.

    0 讨论(0)
  • 2020-12-01 13:34

    Versions

    FF v48 Selenium Webdriver v2.53.1
    Windows 7 (x64)
    .Net 4.0 and .Net 4.5

    Trying the fixes

    As per @jaffa I manually added the following refereces and got the problem:

    WebDriver.dll v2.53.1
    WebDriver.Support.dll v2.53.1


    I then unreferenced them and followed @HassanRahman and used NuGet:

    WebDriver.dll v2.53.1
    WebDriver.Support.dll v2.53.1

    Still same error.

    OpenQA.Selenium.WebDriverException : Failed to start up socket within 45000


    Troubleshooting

    I had a hunch and decided to downgrade from targeting .Net 4.5 to .Net 4.0 (Full not client profile) and the error changed to:

    An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll Additional information: Cannot find Firefox binary in PATH or default install locations. Make sure Firefox is installed. OS appears to be: Vista

    I wondered if this is why people who reinstalled FireFox got it to work again?

    Somewhere there has to be a set of Registry Keys or an Environment Variable to find FireFox's ApplicationStartupPath. You can see some of those paths in this ProcessMonitor trace:

    In the screenshot above you can see the app (AstrobLabe) I'm using running this line of code:

    using (IWebDriver driver = new FirefoxDriver(ffprofile))
    

    It causes a search for FireFox v48 and its looking in the wrong directory:

    C:\Program Files (x86)\Mozilla FireFox\FireFox.exe

    On my system FireFox is installed in:

    C:\Program Files (x86)\Mozilla\Firefox\FireFox.exe

    Anyway finding and correcting this issue (Cannot find Firefox binary in PATH or default install locations) is for someone else to fix, I just copied the Firefox directory to Mozilla FireFox.

    But then it goes back to the original error:

    An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll Additional information: Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055

    Solution

    Then I came across this answer which says that FireFox v46 works with Selenium 2.53: Which Firefox version is compatible with Selenium 2.53.0?

    When I downgraded I saw that FFv46 installs to:

    C:\Program Files (x86)\Mozilla FireFox\FireFox.exe

    So check if your FF install is in this location - which based on the ProcessMonitor Trace Selenium cant find:

    C:\Program Files (x86)\Mozilla\Firefox\FireFox.exe

    0 讨论(0)
  • 2020-12-01 13:35

    I had this issue with latest version of both Firefox (42) and Selenium (2.48.2). Uninstalling and re-installing (via Nuget) fixed the issue for me.

    0 讨论(0)
  • 2020-12-01 13:37

    I found that running an older version of resharper (9.2) failed to work with the latest nunit and that caused selenium to timeout.

    The temporary solution was to disable resharper (Tools -> Options -> Resharper -> Disable), the permanent solution is upgrading resharper.

    0 讨论(0)
  • 2020-12-01 13:37

    Updating through "NuGet" is what helped me. Firefox 47 and Selenium Webdriver 2.53 wasn't working. Checking the selenium site, it still shows "2.53" as their latest. Checking "NuGet" though, I saw there was a "2.53.1" version available. Installing that version is what got my Firefox 47 to work again.

    0 讨论(0)
提交回复
热议问题