Saket Belokar
Saket Belokar

Reputation: 35

How to open a new tab in same session

How to open a new tab in same session, I have already tried common solution given by others but its not working.

I am trying in chrome browser.

My project is in java

Upvotes: 1

Views: 2625

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193058

To open a New Blank TAB you can use the following line of code :

((JavascriptExecutor) driver).executeScript("window.open('','_blank');");

To open a New TAB with url you can use the following line of code :

((JavascriptExecutor) driver).executeScript("window.open('http://facebook.com/');");

Upvotes: 1

Related Questions