Open new tab Selenium 3.0 and geckodriver using control T does not work

120 Views Asked by At

Using Keys.CTRL + t, is not opening new tab in Selenium 3.0 with gecko driver

driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
1

There are 1 best solutions below

0
On

once I tried Robot for that, like -

try{
        Robot robot = new Robot();
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_T);
    }catch (AWTException e){
        e.printStackTrace(); // Or do whatever in here
    }

I don't really sure in relation of keys in here (VK_CONTROL and VK_T), that's what you'll have to find out, but it worked for me. P.S. Probably, you'll have to release keys after.