Nic*_*ahn 17 c# firefox webdriver selenium-webdriver
我正在使用FF版本19
它一切正常,直到昨天,突然今天早上我开始得到这个错误,我有与之前运行的相同的确切代码,没有任何改变
错误信息:
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).
Run Code Online (Sandbox Code Playgroud)
这是我的源代码:
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;
}
Run Code Online (Sandbox Code Playgroud)
Arr*_*ran 18
在Selenium的最新版本中添加了Firefox 19"支持".因此,由于您使用的是.NET,因此本文发布时最新的直接下载版本为2.31.2:
selenium-release.storage.googleapis.com/index.html
我在Firefox 43和Selenium 2.48中遇到过这个问题.当您的Selenium驱动程序服务器以32位进程运行并启动64位版本的Firefox时会发生这种情况.
原因是webdriver服务器尝试连接到端口7055,端口7055应该由Firefox可执行文件中运行的webdriver打开.但是你可以在www.sysinternals.com的TcpView中看到Firefox没有打开这个端口.所以驱动程序等待直到超时(45秒)结束.
即使在完全关闭Windows防火墙后也会发生这种情况.
我在互联网上发现的所有帖子都没有帮助:升级Selenium,降级Firefox等等.
但是在安装了同样的Firefox 43的32位版本后,它可以工作.我在TcpView中看到Firefox 32位如何正确打开端口:
在我的代码中我使用
FirefoxProfile Prof = new FirefoxProfile();
FirefoxBinary Bin = new FirefoxBinary(sBrowserExe);
mDriver = new FirefoxDriver(Bin, Prof);
Run Code Online (Sandbox Code Playgroud)
随着sBrowserExe = "C:\Program Files\Mozilla Firefox 43\firefox.exe"
64位版本的Firefox 43启动,我得到了超时异常.
随着sBrowserExe = "C:\Program Files (x86)\Mozilla Firefox 43\firefox.exe"
32位版本的Firefox 43启动,它的工作原理!
更新: Firefox的开发人员现在完全打破了Selenium的支持.48以上的新Firefox版本需要安装所有扩展的数字签名.
https://wiki.mozilla.org/Addons/Extension_Signing
我不明白为什么Selenium人无法获得当前Selenium驱动程序的签名?
Firefox版本47.0有一个不允许与Selenium一起使用的bug.版本47.0.1中已修复此错误.
48.0及更高版本的Firefox版本不再安装旧的Selenium驱动程序.它们必须使用Marionette(= Gecko)驱动程序自动化.
问题是Marionette仍然是测试版,并且有很多缺少的功能,所以目前还没有自动化新Firefox版本的解决方案.
正如您在此处看到的,新驱动程序充满了错误:https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status
| 归档时间: |
|
| 查看次数: |
17480 次 |
| 最近记录: |