Switch tabs using Selenium WebDriver with Java

前端 未结 21 1153
野性不改
野性不改 2020-11-22 12:09

Using Selenium WebDriver with JAVA. I am trying to automate a functionality where I have to open a new tab do some operations there and come back to previous tab (Parent). I

21条回答
  •  抹茶落季
    2020-11-22 12:51

    Simple Answer which worked for me:

    for (String handle1 : driver1.getWindowHandles()) {
            System.out.println(handle1); 
            driver1.switchTo().window(handle1);     
    }
    

提交回复
热议问题