我正在尝试使用 selenium 测试我的网络应用程序。为了进行测试,我使用 Selenium 3.5.2、chromeWebDriver 2.33 和 chrome 版本 62。
问题是,在我创建操作并调用 sendKeys 后,chrome 打开帮助选项卡。我尝试了不同的网页,甚至在 YouTube 上。代码如下:
Actions actions = new Actions(driver);
WebElement element = driver.findElement(By.Id("search_field"));
actions.sendKeys(element, "A").build().perform();
在 perform()
之后,chrome 会打开一个新的帮助选项卡。
感谢您的解答!
最佳答案
当 Chrome 浏览器于 2017 年 10 月 20 日从版本 61.0.xxx 更新到版本 62.0.3202.62(官方版本)(64 位)时,我遇到了相同的新标签页打开问题
那时我的配置是; Mac 操作系统、Selenium 3.4.0、chromedriver 2.30
今天我将 chrome 驱动程序更新为 chromedriver 2.33,保留在 Selenium 3.4.0 中,它解决了问题。更新到 Selenium 3.5.3 也没有什么坏处
关于java - Selenium 在 SendKeys 之后打开新选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46849969/