无法处理硒中的弹出窗口+ IE9
我试图找到当我使用 Selenium 单击链接时打开的弹出窗口的 ID。
代码是
public String getWindowId() {
String feedWinId = test.getEval("{var windowId; for(var x in selenium.browserbot.openedWindows ) {windowId=x;} }");
return feedWinId;
//return feedWinId.contains("chat");
}
现在这适用于 Firefox,但在 IE 9 上返回 null。知道为什么吗? IE 也有解决
方法我的要求只是检查单击链接时是否打开了弹出窗口。一旦获得 WindowId,我就会使用类似的方法
test.waitForPopUp(getWindowId(), ResourceConstants.POPUP_TIMEOUT);
来检查弹出窗口
I am trying to find the id of a popup window which opens when I click on a link using Selenium.
The code is
public String getWindowId() {
String feedWinId = test.getEval("{var windowId; for(var x in selenium.browserbot.openedWindows ) {windowId=x;} }");
return feedWinId;
//return feedWinId.contains("chat");
}
Now this is working for Firefox but it returns null on IE 9.Any idea why ? also is there a workaround for IE
P.S. My requirement is simply to check if a popup opened when the link was clicked.Once I get the WindowId, i use something like
test.waitForPopUp(getWindowId(), ResourceConstants.POPUP_TIMEOUT);
to check fo the popup
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过
selenium.GetAllWindowIds();
?然后使用
selenium.selectwindows(windowId);
切换到一个窗口,并检查它是否是您想要的弹出窗口。Have you tried
selenium.GetAllWindowIds();
?Then switch to a window with
selenium.selectwindows(windowId);
and check if it is the popup you wish.