Shu*_*pto 3 selenium windows-7 selenium-firefoxdriver
我们使用 selenium webdriver dll 设置来运行我的自动化套件。我只在 Firefox 中运行测试时遇到这个问题。Firefox 中的测试运行非常缓慢,加载页面需要 3-4 分钟,但是,当我手动使用 Firefox 浏览器在同一台机器上运行相同的测试时,我没有遇到这种缓慢的情况。有时在 Firefox 上运行自动化时,我们也会看到“连接已重置”页面。此外,相同的测试在 Chrome 和 IE 中运行良好。
我们使用以下环境:
Firefox 版本 28、37(代理设置为使用系统设置)
Webdriver (dll) 版本 2.45
Windows 7的
之前我们使用 Firefox 版本 14,16 和 Webdriver 版本 2.37 在 Windows XP 中运行相同的设置,我们没有遇到这个问题。
我们使用以下代码调用 Firefox:
Proxy proxy = new Proxy();
proxy.Kind = ProxyKind.System;
FirefoxProfile profile = new FirefoxProfile();
profile.SetProxyPreferences(proxy);
RemoteWebDriver dr = new FirefoxDriver(new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"), profile, TimeSpan.FromSeconds(120));
dr.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(3));
dr.Manage().Window.Maximize();
dr.Manage().Cookies.DeleteAllCookies();
dr.Navigate().GoToUrl(WebSiteUrl);
Run Code Online (Sandbox Code Playgroud)
剩余测试步骤......
请有人帮我解决这个问题。
提前致谢。
这就是我解决“非常慢的 FirefoxDriver ”问题的方法:
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.Host = "::1";
IWebDriver driver = new FirefoxDriver(service);
Run Code Online (Sandbox Code Playgroud)
上面的代码强制geckodriver使用 IPv6 协议,它与 UI 元素的交互速度快了很多倍。
| 归档时间: |
|
| 查看次数: |
4948 次 |
| 最近记录: |