【问题标题】:Not able to handle popups in selenium + IE9无法处理 selenium + IE9 中的弹出窗口
【发布时间】:2012-02-20 12:32:43
【问题描述】:

我正在尝试查找使用 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);

检查弹出窗口

【问题讨论】:

    标签: selenium popup internet-explorer-9


    【解决方案1】:

    你试过selenium.GetAllWindowIds();吗? 然后切换到带有selenium.selectwindows(windowId);的窗口并检查它是否是您想要的弹出窗口。

    String[] ids = selenium.GetAllWindowIds();
    for (int i = 0; i < ids.length; i++)
    {
        selenium.WaitForPopUp(ids[i], "30000");
        selenium.selectwindow(pids[i]);
        //check if it is your popup
        //if yes then break;
    }
    

    【讨论】:

      猜你喜欢
      • 2021-01-11
      • 1970-01-01
      • 2021-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多