Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)
edited by

How to open a new tab in the existing Firefox browser using Selenium WebDriver (a.k.a. Selenium 2)?

closed

1 Answer

+1 vote
by (62.9k points)
selected by
 
Best answer

The code below can open a link in a new Tab.

String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,Keys.RETURN);

driver.findElement(By.linkText("urlLink")).sendKeys(selectLinkOpeninNewTab);

 

The code below will open empty new Tab.

String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,"t");

driver.findElement(By.linkText("urlLink")).sendKeys(selectLinkOpeninNewTab);

 Hope this helps!



 

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...