2013-03-06 29 views
17

啓動插座我使用FF版本19無法內45000

這是所有工作的罰款,直到昨天突然今天早上,我開始得到這個錯誤,我有一個運行前完全相同的代碼,沒有改變什麼

錯誤消息:

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). 

這裏是我的源代碼:

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; 
     } 
+0

可能是Firefox瀏覽器得到更新? – Hemanth 2013-03-06 14:26:45

+0

ff 19是最新的,所以我不確定 – 2013-03-06 14:50:12

+0

您使用的是什麼Selenium版本?我知道,直到它是最新版本,它有問題與Firefox。 – Arran 2013-03-06 14:53:06

回答

18

Selenium最新版本增加了Firefox 19'支持'。所以,既然你使用的是.NET,直接下載最新的這個帖子的時候是2.31.2版本:

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

+0

現在從這裏獲取最新版本:http://selenium-release.storage.googleapis.com/index.html – phabtar 2014-04-09 08:05:48

+0

這並不能解決問題。即使使用Selenium 2.48,我也有相同的超時異常。 – Elmue 2016-03-07 17:17:16

+3

不是一個好主意:這是Google搜索abover錯誤消息的第三個結果。許多人會來這裏讀這個。 – Elmue 2016-03-07 17:26:19

4

如果升級Webdriver不能幫助您降級可解決問題的FireFox。

+1

這個想法是測試最新的Firefox版本。降級Firefox並不是一個解決方案! – Elmue 2016-03-07 17:15:52

6

我對Firefox 43和Selenium 2.48有此問題。 當您的Selenium驅動程序服務器在32位進程中運行並啓動64位版本的Firefox時,會發生這種情況。

的原因是服務器的webdriver嘗試連接到端口7055應由在Firefox的可執行文件運行的webdriver被打開。但是你可以從www.sysinternals.com看到TcpView Firefox不打開這個端口。因此,駕駛員等待,直到他的超時(45秒)過去。

即使完全關閉Windows防火牆,也會發生這種情況。

,我在互聯網上找到的所有信息不幫助:升級硒,降級火狐等。

但安裝相同的Firefox 43它工作的32位版本之後。我的TCPView看到Firefox的32位正確打開的端口:

Firefox Selenium webdriver Port 7055

在我的代碼我使用

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

隨着sBrowserExe = "C:\Program Files\Mozilla Firefox 43\firefox.exe" 火狐43的64位版本開始,我得到的超時例外。

With sBrowserExe = "C:\Program Files (x86)\Mozilla Firefox 43\firefox.exe" Firefox 43的32位版本已啓動,它的工作原理!


UPDATE:從Firefox的開發者現在打破了硒完全表示支持。48個以上的新Firefox版本需要安裝所有擴展的數字簽名。

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

我不明白的是爲什麼硒人不能得到當前硒司機的簽名?

Firefox版本47.0有一個錯誤,不允許在Selenium中使用它。該錯誤已在版本47.0.1中修復。

來自48.0及更高版本的Firefox版本不再安裝舊的Selenium驅動程序。他們必須使用Marionette(= Gecko)驅動程序進行自動化。

問題是,木偶仍然是測試版,並有很多缺失的功能,所以目前沒有解決方案來自動化新的Firefox版本。

正如你在這裏看到的新的驅動程序是完全錯誤的:https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status

+0

我在Windows 7,64位機器上使用firefox 48,32位。我仍然遇到你提到的錯誤。但是,在TCPView中,firefox不會打開端口7055.請建議我如何解決這個問題。 – testerjoe2 2016-09-26 22:20:01

+0

我更新了我的答案以回答您的問題。 – Elmue 2016-09-28 16:55:45

0

在您的NuGet包管理器安裝所有更新。重新啓動IDE。

不推薦下載firefox版本進行測試。但是最後只有一個版本的降級聽起來不錯。

此解決方案適用於我。

相關問題