问题描述
我正在使用 SeleniumHq 站点的示例代码 - 但在调试模式下,性能很糟糕.
I'm using the example code from the SeleniumHq site - but in debug mode the performance is awful.
在发布模式下,整个测试大约需要 6 秒(包括启动和关闭 IE)在 Debug 模式下需要 65 秒?
In release mode the entire test takes about 6 seconds (including launching and closing IE) In Debug mode it takes 65 seconds ?
示例代码只是:
[Test]
public void testBrowser()
{
// Do something here
IWebDriver driver = new InternetExplorerDriver();
//Notice navigation is slightly different than the Java version
//This is because 'get' is a keyword in C#
driver.Navigate().GoToUrl("http://www.google.com");
IWebElement query = driver.FindElement(By.Name("q"));
query.SendKeys("Cheese");
System.Console.WriteLine("Page title is: " + driver.Title);
// TODO add wait
driver.Quit();
}
我已经在 ie8 中尝试过,并且具有相同的性能.Firefox 很好——但我的客户使用 IE,所以我坚持测试它.另外 - 如果我使用 Selenium RC,我不会遇到同样的问题.
I've tried it in ie8 and have the same performance. Firefox is fine - but my clients use IE so I'm stuck with testing against it. Also - I don't have the same issues if I use Selenium RC.
注意 - 我正在使用 .Net 4 和最新版本 (2.16) 的 webDriver.dll(在 64 位 Windows 7 机器上运行)
NB - I'm using .Net 4 and the latest version (2.16) of the webDriver.dll (running on a 64bit windows 7 box)
推荐答案
对我来说,解决方法是从 InternetExplorerDriver.exe/code.google.com/p/selenium/downloads/list" rel="nofollow noreferrer">https://code.google.com/p/selenium/downloads/list
For me, the fix was to switch to the 32 bit version of InternetExplorerDriver.exe
from https://code.google.com/p/selenium/downloads/list
现在看似命名为 IEDriverServer
,但只要将其重命名为 InternetExplorerDriver.exe
即可.
Seemingly named IEDriverServer
nowadays, but works if you just rename it to InternetExplorerDriver.exe
.
这篇关于为什么 Selenium InternetExplorerDriver Webdriver 在调试模式下非常慢(Visual Studio 2010 和 IE9)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!