我正在使用 Selenium Chromewebdriver 3.7 自动化测试。每次打开网站时,都会弹出证书选择弹窗,如下所示
然而,我无法点击“确定”按钮。这些是我尝试过的选项。
//I have tried getWindowHandle like this
String handle= driver.getWindowHandle();
this.driver.switchTo().window(handle);
//I have alos tried switching and accept
driver.switchTo().alert().accept();
//I have also tried to force the enter key like this
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
// I also tried this way
Scanner keyboard = new Scanner(System.in);
keyboard.nextLine();
我所有的尝试都失败了。我怎样才能在这个弹出窗口上点击“确定”? 这是我找到的最接近的解决方案,但它并没有起作用。链接在此