Skip to content

Instantly share code, notes, and snippets.

@IsmagilovQA
Last active January 5, 2022 15:07
Show Gist options
  • Save IsmagilovQA/3e7c6aeddcd0b103d2155a23d8c61a5a to your computer and use it in GitHub Desktop.
Save IsmagilovQA/3e7c6aeddcd0b103d2155a23d8c61a5a to your computer and use it in GitHub Desktop.
Selenium | Open new tab via Keys and JavaScript
Option 1: driver.FindElement(By.CssSelector("body")).SendKeys(Keys.LeftControl + "T");
Option 2: String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,"t");
Option 3: executeJavaScript("window.open()");
Option 4: driver.switchTo().window(new ArrayList<>(WebDriverRunner.getWebDriver().getWindowHandles()).get(numberTab - 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment