Java 类org.openqa.selenium.security.Credentials 实例源码
项目:menggeqa
文件:DefaultAspect.java
@Before(EXECUTION_ALERT_AUTHENTICATION)
public void beforeAlertAuthentication(JoinPoint joinPoint) throws Throwable {
try {
listener.beforeAuthentication(driver,
(Alert) castTarget(joinPoint), (Credentials) castArgument(joinPoint, 0));
} catch (Throwable t) {
throw getRootCause(t);
}
}
项目:menggeqa
文件:DefaultAspect.java
@After(EXECUTION_ALERT_AUTHENTICATION)
public void afterAlertAuthentication(JoinPoint joinPoint) throws Throwable {
try {
listener.afterAuthentication(driver, (Alert) castTarget(joinPoint),
(Credentials) castArgument(joinPoint, 0));
} catch (Throwable t) {
throw getRootCause(t);
}
}
项目:webtester2-core
文件:AlertHandlerTest.java
@Test
public void canAuthenticateWithUsernameAndPassword() {
Alert alert = alertIsPresent("please sign in");
cut.authenticateWith("foo", "bar");
verify(alert).authenticateUsing(credentialsCaptor.capture());
Credentials credentials = credentialsCaptor.getValue();
assertThat(credentials).isInstanceOf(UserAndPassword.class);
assertThat((( UserAndPassword ) credentials).getUsername()).isEqualTo("foo");
assertThat((( UserAndPassword ) credentials).getPassword()).isEqualTo("bar");
}
项目:menggeqa
文件:DefaultListener.java
@Override
public void beforeAuthentication(WebDriver driver, Alert alert, Credentials credentials) {
((AlertEventListener) dispatcher).beforeAuthentication(driver, alert, credentials);
}
项目:menggeqa
文件:DefaultListener.java
@Override
public void afterAuthentication(WebDriver driver, Alert alert, Credentials credentials) {
((AlertEventListener) dispatcher).afterAuthentication(driver, alert, credentials);
}
项目:cinnamon
文件:CinnamonAlert.java
@Override
public void setCredentials(Credentials credentials) {
alert.setCredentials(credentials);
}
项目:cinnamon
文件:CinnamonAlert.java
@Override
public void authenticateUsing(Credentials credentials) {
alert.authenticateUsing(credentials);
waitUntilAlertIsNotPresent();
}
项目:darcy-webdriver
文件:ForwardingTargetedAlert.java
@Override
public void setCredentials(Credentials credentials) {
alert().setCredentials(credentials);
}
项目:darcy-webdriver
文件:ForwardingTargetedAlert.java
@Override
public void authenticateUsing(Credentials credentials) {
alert().authenticateUsing(credentials);
}
项目:webtester2-core
文件:AlertHandlerTest.java
@Test
public void canAuthenticateWithCredentials() {
Alert alert = alertIsPresent("please sign in");
Credentials credentials = new UserAndPassword("foo", "bar");
cut.authenticateWith(credentials);
verify(alert).authenticateUsing(credentials);
}
项目:selenium-on-steroids
文件:WebDriverHelper.java
/**
* Authenticates the user using the given username and password. This will
* work only if the credentials are requested through an alert window.
*
* @param username
* the user name
* @param password
* the password
*/
public void authenticateOnNextAlert(String username, String password) {
Credentials credentials = new UserAndPassword(username, password);
Alert alert = driver.switchTo().alert();
alert.authenticateUsing(credentials);
}
项目:menggeqa
文件:AlertEventListener.java
/**
* This action will be performed each time before
* {@link org.openqa.selenium.Alert#setCredentials(Credentials)} and
* {@link org.openqa.selenium.Alert#authenticateUsing(Credentials)}
*
* @param driver WebDriver
* @param alert {@link org.openqa.selenium.Alert} which is receiving user credentials
* @param credentials which are being sent
*/
void beforeAuthentication(WebDriver driver, Alert alert,
Credentials credentials);
项目:menggeqa
文件:AlertEventListener.java
/**
* This action will be performed each time after
* {@link org.openqa.selenium.Alert#setCredentials(Credentials)} and
* {@link org.openqa.selenium.Alert#authenticateUsing(Credentials)}
*
* @param driver WebDriver
* @param alert {@link org.openqa.selenium.Alert} which has received user credentials
* @param credentials which have been sent
*/
void afterAuthentication(WebDriver driver, Alert alert,
Credentials credentials);
项目:webtester2-core
文件:AlertHandler.java
/**
* Authenticate a Basic-Auth popup using the given {@link Credentials credendials}.
* <p>
* This operation is decalred as "BETA" by the Selenium developers and might break in the future in case it changes.
*
* @param credentials the credentials to use
* @see Alert#authenticateUsing(Credentials)
* @since 2.0
*/
@Beta
public void authenticateWith(Credentials credentials) {
ActionTemplate.browser(browser()).execute(browser -> webDriver().switchTo().alert().authenticateUsing(credentials));
log.debug("authenticated using credentials: {}", credentials);
}