Switch tabs using Selenium WebDriver with Java

前端 未结 21 1646
野性不改
野性不改 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 13:07

    driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL,Keys.SHIFT,Keys.TAB);
    

    This method helps in switching between multiple windows. The restricting problem with this method is that it can only be used so many times until the required window is reached. Hope it helps.

提交回复
热议问题