use of org.openqa.selenium.Alert in project openmeetings by apache.
the class TestSignUp method testSignUp.
@Test
public void testSignUp() throws Exception {
try {
driver.get(getBASE_URL());
String currentRandomCounter = "" + ((new Date().getTime()) / 1000);
String userName = "seba" + currentRandomCounter;
String email = "hans." + currentRandomCounter + "@openmeetings.apache.org";
super.testIsInstalledAndDoInstallation();
WebElement signUpButton = SeleniumUtils.findElement(driver, "//button[span[contains(text(), '" + getString("123") + "')]]", true, true);
signUpButton.click();
// ##################################
// Test validation message for passwords to be identical
// ##################################
doSignUp("Hans", "Muster", userName, "pw", "pw2", email);
// Find Error label-id 232 "Please enter two identical passwords"
SeleniumUtils.findElement(driver, "//span[@class='feedbackPanelERROR'][contains(text(), '" + getString("232") + "')]", true, true);
// ##################################
// Sign up with user and sign in
// ##################################
doSignUp("Hans", "Muster", userName, pass, pass, email);
// Check for popup with success message and email to check
SeleniumUtils.findElement(driver, "//span[contains(text(), '" + getString("warn.notverified") + "')]", true, true);
// click button to close popup
WebElement signUpSucessPopUpOkButton = SeleniumUtils.findElement(driver, "//button[span[contains(text(), '" + DialogButtons.OK.toString() + "')]]", true, true);
signUpSucessPopUpOkButton.click();
// Login with user
SeleniumUtils.inputText(driver, "login", userName);
SeleniumUtils.inputText(driver, "pass", pass);
// click labelid 112 "Sign In"
WebElement signInButton = SeleniumUtils.findElement(driver, "//button[span[contains(text(), '" + getString("112") + "')]]", true, true);
signInButton.click();
// check for some text in dashbaord, labelid 281, "Help and support"
SeleniumUtils.elementExists(driver, "//h3[contains(text(), '" + getString("281") + "')]", true);
// sign out
WebElement signOutLink = SeleniumUtils.findElement(driver, "//a[contains(text(), '" + getString("310") + "')]", true, true);
signOutLink.click();
Alert alert = driver.switchTo().alert();
alert.accept();
// ##################################
// Sign up with same user and email and check duplicate messages
// ##################################
signUpButton = SeleniumUtils.findElement(driver, "//button[span[contains(text(), '" + getString("123") + "')]]", true, true);
signUpButton.click();
doSignUp("Hans", "Muster", userName, pass, pass, email);
SeleniumUtils.findElement(driver, "//span[@class='feedbackPanelERROR'][contains(text(), '" + getString("error.login.inuse") + "')]", true, true);
SeleniumUtils.findElement(driver, "//span[@class='feedbackPanelERROR'][contains(text(), '" + getString("error.email.inuse") + "')]", true, true);
} catch (Exception e) {
SeleniumUtils.makeScreenShot(this.getClass().getSimpleName(), e, driver);
throw e;
}
}
use of org.openqa.selenium.Alert in project edx-app-android by edx.
the class NativeAppDriver method acceptAlert.
/**
* Accept the alert
*/
public void acceptAlert() {
WebDriverWait wait = (WebDriverWait) new WebDriverWait(appiumDriver, maxWaitTime, 500);
wait.until(ExpectedConditions.alertIsPresent());
Alert alrt = appiumDriver.switchTo().alert();
alrt.accept();
}
use of org.openqa.selenium.Alert in project keycloak by keycloak.
the class WebAuthnRegisterPage method isRegisterAlertPresent.
public boolean isRegisterAlertPresent(long seconds) {
try {
// label edit after registering authenticator by .create()
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(seconds));
Alert promptDialog = wait.until(ExpectedConditions.alertIsPresent());
assertThat(promptDialog.getText(), CoreMatchers.is("Please input your registered authenticator's label"));
return true;
} catch (TimeoutException e) {
return false;
}
}
use of org.openqa.selenium.Alert in project liferay-blade-samples by liferay.
the class BladeSampleFunctionalActionUtil method isAlertPresent.
public static boolean isAlertPresent(WebDriver webDriver) {
try {
WebDriverWait webDriverWait = new WebDriverWait(webDriver, 15);
Alert alert = webDriverWait.until(ExpectedConditions.alertIsPresent());
if (alert != null) {
webDriver.switchTo().alert().accept();
return true;
} else {
throw new NoAlertPresentException();
}
} catch (NoAlertPresentException nape) {
return false;
}
}
Aggregations