I am trying to do basic browser-tab operations for Chrome browser like -
- opening a new tab
- switching to it
- closing the tab
However, none of the methods that I tried are working, listed below:
Actions class in Selenium ---
actions.click(driver.findElement(By.cssSelector("body"))).keyDown(Keys.LEFT_CONTROL).sendKeys("t") .keyUp(Keys.LEFT_CONTROL).build().perform();
Through
sendKeys()
---driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL + "t");
I also searched the net for a solution but all these issues are 3 to 4 years old and it appears the listed solutions are not working for me :(
I am using:
- Java 8
- Selenium v3.141.59
- Chrome v80.0.3987.132
- webdrivermanager v3.8.1
Please reply if you know any solution or workaround for this; any help will be appreciated.. :)
Thanks