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, please leave comments if anything needs to be added or updated, discuss your queries on our facebook:qavalidation.com, Thanks!

Leave a Reply

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

%d bloggers like this: