0

帮助代码

      String parentWindowHandle = browser.getWindowHandle(); // save the current window handle.
      WebDriver popup = null;
      Iterator<String> windowIterator = browser.getWindowHandles();
      while(windowIterator.hasNext()) { 
      String windowHandle = windowIterator.next(); 
      popup = browser.switchTo().window(windowHandle);
        if (popup.getTitle().equals("Google") {
          break;
        }
      }
4

1 回答 1

0

如果我理解正确。

for (String handle : driver.getWindowHandles()) {
  driver.switchTo().window(handle);
}

http://code.google.com/p/selenium/wiki/NextSteps

于 2012-08-25T10:15:54.390 回答