Created
September 19, 2016 19:04
-
-
Save 4M01/b6231856976e45bfc60bd7bbbc46b69e to your computer and use it in GitHub Desktop.
Open a blank tab in a browser using Selenium WebDriver for Mac & windows . Please check http://qaperspective.blogspot.in/2016/09/open-new-tab-using-Selenium-WebDriver.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void openNewTab() { | |
String osName = System.getProperty("os.name").toLowerCase(); | |
if (osName.contains("win")) { | |
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL + "t"); | |
} else { | |
driver.findElement(By.cssSelector("body")).sendKeys(Keys.COMMAND + "t"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment