这是我打开新标签页的行

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

最佳答案

((JavascriptExecutor)driver).executeScript("window.open();");


此JavaScript代码为Chrome浏览器打开了一个新标签。

关于selenium - 我无法在Google Chrome中使用 Selenium 打开新标签,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23174329/

10-10 04:26