0 votes
1 view
in Devops and Agile by (25k points)
edited by

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

1 Answer

+1 vote
by (63.3k 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!



 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...