51Testing软件测试论坛
标题:
又来麻烦大家了
[打印本页]
作者:
skysolo
时间:
2011-12-31 14:22
标题:
又来麻烦大家了
直接发代码:
public void testUntitled() throws Exception {
selenium.open("/");
selenium.type("id=txtUserName","cxn");
selenium.type("id=txtPassword","1");
selenium.click("id=A1");
selenium.waitForPageToLoad("5000");
selenium.select("id=ddlOrganList","label=aa");
selenium.click("//select[@id='ddlOrganList']/option");
Thread.sleep(10000);
String[] strArray = selenium.getAllWindowNames();
for(String str : strArray){
System.out.println(str);
selenium.selectWindow("null");
assertTrue(selenium.isTextPresent("今天是:2011-12-31"));
}
}
在a窗口执行完 selenium.click("//select[@id='ddlOrganList']/option");之后,会弹出新的窗口b,我希望定位到b窗口执行新的测试。
1.我发现执行Thread.sleep(10000)的时候,是停留在b窗口的,那么说明已经定位到b窗口了?
2.getAllWindowNames()的返回值是"null",说明b窗口的属性是null?
3. 执行
selenium.selectWindow("null");
assertTrue(selenium.isTextPresent("今天是:2011-12-31"));
RC报错:current windos or frame is colsed。为什么会报这个错,这个current windows怎么会关闭呢?是指a窗口关闭?但是焦点不是已经到b窗口了吗?而且已经通过select wiondow强行让焦点到b窗口了呀。这到底是为什么~如果null是a窗口的属性,那b窗口的呢?getAllWindowNames()应该可以把a窗口和b窗口的属性都获得呀。
作者:
skysolo
时间:
2011-12-31 16:16
回复
1#
skysolo
查看了下RC的操作日志,可能发现了“current window or frame was closed”的原因,请看下面的日志
click(css=option[value="001-002"])
selectWindow()
open(
http://192.168.0.33:6666
)
我们可以看见,RC在执行完click操作之后,会自动的运行
selectWindow()
open(
http://192.168.0.33:6666
)
因为
http://192.168.0.33:6666
,也就是a界面已经关闭了,所以就出现这样的提示,
问题又来了,如何不让RC自动执行
selectWindow()
open(
http://192.168.0.33:6666
)
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2