网页>>框架>>d出窗口处理

网页>>框架>>d出窗口处理,第1张

网页>>框架>>d出窗口处理

尝试这样:

        String mainWindow = driver.getWindowHandle();        Set<String> windows= driver.getWindowHandles();        if (windows.size() > 1) { //first remove main window windows.remove(mainWindow); //switching to new/child window and perform some action on new window if required. Then close it. driver.switchTo().window(windows.iterator().next()); driver.close(); //switching back to mainWindow, Then continue with your actions. driver.switchTo().window(mainWindow); windows.clear();        }


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5122087.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-17
下一篇 2022-11-17

发表评论

登录后才能评论

评论列表(0条)

保存