Last active
January 5, 2022 15:07
-
-
Save IsmagilovQA/3e7c6aeddcd0b103d2155a23d8c61a5a to your computer and use it in GitHub Desktop.
Selenium | Open new tab via Keys and JavaScript
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
| 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