Select Page
Selenium Testing

Selenium 4.0 Command to Open New Window & Tab

In Selenium 4.0, you can open new window & tab using “newWindow” command.

Listen to this blog

In Selenium 4.0, you can open new window & tab using “newWindow” command. Please note: Selenium 4.0 is yet to be released. However, you can try this feature using Firefox 66 & Selenium 4.0.0-alpha-1 versions.

Selenium 4.0 (Alpha) Maven Dependency

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-alpha-1</version>
</dependency>

Code

System.setProperty("webdriver.gecko.driver", "drivers/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.switchTo().newWindow(WindowType.WINDOW);
driver.switchTo().newWindow(WindowType.TAB);

Follow our blog to receive Selenium related updates.

Comments(0)

Submit a Comment

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

Talk to our Experts

Amazing clients who
trust us


poloatto
ABB
polaris
ooredo
stryker
mobility