0

I want to switch the tabs from one tab to other and need to switch back on previous tab.

So, please guide me for same.

1
  • It works like new windows. Commented Oct 11, 2017 at 6:14

1 Answer 1

0
 String winHandleBefore = driver.getWindowHandle(); // Perform the click operation that opens new window driver.findElement(By.xpath("yourElement").click()); // Switch to new window opened for(String winHandle : driver.getWindowHandles()){ driver.switchTo().window(winHandle); } // Perform the actions on new window // Close the new window, if that window no more required driver.close(); // Switch back to original browser (first window) driver.switchTo().window(winHandleBefore); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.