0

使用 Keys.CTRL + t,不会在 Selenium 3.0 中使用 gecko 驱动程序打开新选项卡

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

1 回答 1

0

一旦我为此尝试了机器人,就像-

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)的关系,这就是你必须找出的,但它对我有用。PS 可能,您必须在之后释放密钥。

于 2017-12-27T12:57:00.530 回答