使用Windows 2008,C#,Firefox 3.5.1,Selenium RC(v1.0.1)Selenium Firefox Open timeout
当它工作时,此代码执行速度非常快,页面在0.5秒内加载。
但是,会话总是在3-5次迭代后失败。打开命令会导致窗口生成,但不会加载页面。最终返回超时异常。该页面实际上没有超时。相反,它好像对URL的请求从未到达浏览器窗口。
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
var s = new DefaultSelenium("localhost", 4444, "firefox", "http://my.server");
s.Start();
s.SetSpeed("300");
s.Open("/");
s.WaitForPageToLoad("30000");
s.Type("//input[contains(@id, '_username')]", "my.test");
s.Type("//input[contains(@id, '_password')]", "password");
s.Stop();
}
}
}
我们使用了一个新的Selenium实例,因此每次测试都使用浏览器实例...并不酷。 – Blundell 2011-06-01 15:34:48