答案 0 :(得分:0)
这不是HTML表单。这是OS提供的对话框,而不是浏览器。所以你不能用selenium来自动化它。
您可以使用Java类Robot
来操作它,但Robot
类只能在脚本所在的本地操作对话框。如果您使用RemoteWebDriver并在远程计算机上打开浏览器,Robot
类将无法工作。
据我所知,同时支持本地和远程案例没有好的解决方案。
答案 1 :(得分:0)
答案 2 :(得分:0)
试试这个
16px
如果你在java中使用selenium试试这个
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.Alert;
driver.switchTo().alert().sendKeys("username" + Keys.TAB + "password");
driver.switchTo().alert().accept();