1. 得到当前窗口句柄
2. 得到所有窗口句柄
3. 循环找到目标窗口
String currentWindow = driver.getWindowHandle();
Set<String> handles = driver.getWindowHandles();
Iterator<String> it = handles.iterator();
while (it.hasNext())
{
String handle = it.next();
if (currentWindow.equals(handle))
continue;
WebDriver window = driver.switchTo().window(handle);
}