Open url in new tab using selenium

In this post we will be seeing how we can open a new browser tab and navigate to a url.

For this we will use

  • Robot class to open new tab (CONTROL + t)
  • Verify if currently driver is on new tab
  • Then navigate to url using WebDriver.

This method is used to open a new tab in any browser irrespective of OS

Another way, without using the for loop

By using the above method, try yourself for other browsers as well!

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *