使用控件T打开新选项卡Selenium 3.0和geckodriver不起作用

问题描述 投票:0回答:1

使用Keys.CTRL + t,没有在带有gecko驱动程序的Selenium 3.0中打开新选项卡

driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t");
geckodriver selenium3
1个回答
0
投票

一旦我尝试了Robot,就像 -

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
    }

我不确定这里的键(VK_CONTROL和VK_T),这是你必须找到的,但它对我有用。附:可能你必须在之后释放密钥。

© www.soinside.com 2019 - 2024. All rights reserved.