How do I change focus to a new popup tab in Selenium?

后端 未结 7 1242
渐次进展
渐次进展 2020-12-29 06:38

I\'m using Selenium and Firefox.

I have a link on a page (say linkA) that opens a new page in a new tab. The new tab is displayed when linkA is clicked. I then w

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 07:00

    Iterator windowIterator = driver.getWindowHandles().iterator();while (windowIterator.hasNext()) {
    String windowHandle = windowIterator.next();
    driverwindow = driver.switchTo().window(windowHandle);
    if (_driverwindow.getTitle().equals("Title of the window to switch")) {
    }
    }
    

提交回复
热议问题