硒RC + c# 如何处理运行新浏览后超时问题?
全部 当我学习selenium rc如何使用selenium.click打开新浏览时,我遇到了一个问题。新的浏览器可以正确打开,但是测试工具NUint显示“超时”问题,无论我添加多少时间,它总是出现超时问题。整个代码如下:
[Test]
public void SelectTest()
{
//selenium = new DefaultSelenium("localhost", 4444, "*chrome","http://www.webkey.cn/demo/docs/index2.asp?url=/demo/docs/menuselect/");
// selenium.Start();
selenium.Open("http://www.webkey.cn/demo/docs/index2.asp?url=/demo/docs/menuselect/");
selenium.WaitForPageToLoad("8000");
selenium.SelectWindow("name=main");
selenium.Select("city","label=上海市");
Assert.AreEqual("上海市",selenium.GetSelectedLabel("city"));
selenium.Select("country","index=1");
Assert.AreEqual("徐汇区",selenium.GetSelectedLabel("country"));
selenium.SelectFrame("relative=up");
selenium.SelectFrame("Header1");
selenium.Click("link=首页");
selenium.WaitForPageToLoad("10000");// This code has timed out problem.
}
all
When I learned the selenium rc how to use selenium.click to open a new browse, I have met a problem. The new browse can be opened correctly, but the test tool NUint showed "timed out" problem, whatever I added the time, it always has the timed out problem.The whole codes as following:
[Test]
public void SelectTest()
{
//selenium = new DefaultSelenium("localhost", 4444, "*chrome","http://www.webkey.cn/demo/docs/index2.asp?url=/demo/docs/menuselect/");
// selenium.Start();
selenium.Open("http://www.webkey.cn/demo/docs/index2.asp?url=/demo/docs/menuselect/");
selenium.WaitForPageToLoad("8000");
selenium.SelectWindow("name=main");
selenium.Select("city","label=上海市");
Assert.AreEqual("上海市",selenium.GetSelectedLabel("city"));
selenium.Select("country","index=1");
Assert.AreEqual("徐汇区",selenium.GetSelectedLabel("country"));
selenium.SelectFrame("relative=up");
selenium.SelectFrame("Header1");
selenium.Click("link=首页");
selenium.WaitForPageToLoad("10000");// This code has timed out problem.
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先增加默认的硒超时(我记得defaulttimeout = 30000):
第二次增加页面加载的等待时间:
编辑:
当时我已经测试了ajax完成的所有点击,并且按顺序使用以下方法重定向后等待页面上的某些元素,因此尝试使用它来等待重定向:
示例:
First increase default selenium timeout(as i remeber defaulttimeout = 30000):
And second increase wait time for page load:
EDIT:
At that i've tested all clicks done by ajax and i use followoning methiod in order to wait some element on page after redirect, so try to use this for wait redirect:
Example:
尝试
Try