"driver.switchTo().alert().Authenticate()"和"driver.switchTo().alert().setCredentails()"有什么区别?两者都使用接口凭据。
发布于 2016-10-20 15:42:07
身份验证在设置凭据后调用接受。它可以在资料来源中找到。
public void setCredentials(Credentials credentials) {
if(!(credentials instanceof UserAndPassword)) {
throw new RuntimeException("Unsupported credentials: " + credentials);
} else {
UserAndPassword userAndPassword = (UserAndPassword)credentials;
RemoteWebDriver.this.execute("setAlertCredentials", ImmutableMap.of("username", userAndPassword.getUsername(), "password", userAndPassword.getPassword()));
}
}
public void authenticateUsing(Credentials credentials) {
this.setCredentials(credentials);
this.accept();
}https://stackoverflow.com/questions/40158441
复制相似问题