WebDriver switching to new window
Posted amy2012
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WebDriver switching to new window相关的知识,希望对你有一定的参考价值。
String firstWindow = driver.getWindowHandle();
Set<String> allWindows = driver.getWindowHandles();
Iterator<String> windowsIterator = allWindows.iterator()
While(windowsIterator.hasNext())
String windowHandle = windowsIterator.next().toString();
if(!windowHandle.equals(firstWindow))
driver.swithTo().window(windowHandle);
break;
以上是关于WebDriver switching to new window的主要内容,如果未能解决你的问题,请参考以下文章
为啥 switch_to_window() 方法不适用于 Python 中的 selenium webdriver?
selenium - webdriver 警告框处理 switch_to.alert
selenium - webdriver 多表单切换 switch_to.frame()
Python爬虫AttributeError: ‘WebDriver‘ object has no attribute ‘switch_to_window‘
Python爬虫AttributeError: ‘WebDriver‘ object has no attribute ‘switch_to_window‘