use of org.openqa.selenium.Alert in project opennms by OpenNMS.
the class UserIT method testSubmitWithWrongPassword.
@Test
public void testSubmitWithWrongPassword() throws InterruptedException {
m_driver.findElement(By.linkText("Change Password")).click();
enterText(By.cssSelector("input[type=password][name=oldpass]"), "12345");
enterText(By.cssSelector("input[type=password][name=pass1]"), "23456");
enterText(By.cssSelector("input[type=password][name=pass2]"), "34567");
m_driver.findElement(By.cssSelector("button[type=submit]")).click();
try {
final Alert alert = wait.until(ExpectedConditions.alertIsPresent());
alert.dismiss();
} catch (final Exception e) {
LOG.debug("Got an exception waiting for a 'wrong password' alert.", e);
throw e;
}
}
use of org.openqa.selenium.Alert in project opennms by OpenNMS.
the class OutagePageIT method testAllLinks.
@Test
public void testAllLinks() throws InterruptedException {
findElementByLink("Current outages").click();
findElementByXpath("//button[contains(@class, 'active') and contains(@onclick, 'current')]");
findElementByXpath("//button[not(contains(@class, 'active')) and contains(@onclick, 'resolved')]");
findElementByXpath("//button[not(contains(@class, 'active')) and contains(@onclick, 'both')]");
findElementByLink("Interface");
outagePage();
findElementByLink("All outages").click();
findElementByXpath("//button[not(contains(@class, 'active')) and contains(@onclick, 'current')]");
findElementByXpath("//button[not(contains(@class, 'active')) and contains(@onclick, 'resolved')]");
findElementByXpath("//button[contains(@class, 'active') and contains(@onclick, 'both')]");
findElementByLink("Interface");
outagePage();
findElementByName("outageIdForm").findElement(By.xpath("//button[@type='submit']")).click();
final Alert alert = wait.until(ExpectedConditions.alertIsPresent());
assertNotNull(alert);
assertEquals("Please enter a valid outage ID.", alert.getText());
alert.dismiss();
}
use of org.openqa.selenium.Alert in project page-factory-2 by sbtqa.
the class TagWebDriver method closeAllAlerts.
private static void closeAllAlerts() {
try {
LOG.info("Checking any alert opened");
WebDriverWait alertAwaiter = new WebDriverWait(webDriver, 2);
alertAwaiter.until(ExpectedConditions.alertIsPresent());
Alert alert = webDriver.switchTo().alert();
LOG.info("Got an alert: '{}'. Closing it...", alert.getText());
alert.dismiss();
} catch (WebDriverException e) {
LOG.debug("No alert opened. Closing webdriver...", e);
}
}
use of org.openqa.selenium.Alert in project Payara by payara.
the class BaseSeleniumTestClass method closeAlertAndGetItsText.
public String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String msg = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return msg;
} finally {
acceptNextAlert = true;
}
}
use of org.openqa.selenium.Alert in project keycloak by keycloak.
the class WebAuthnRegisterPage method registerWebAuthnCredential.
public void registerWebAuthnCredential(String authenticatorLabel) {
if (!isRegisterAlertPresent(ALERT_DEFAULT_TIMEOUT)) {
throw new TimeoutException("Cannot register Security Key due to missing prompt for registration");
}
Alert promptDialog = driver.switchTo().alert();
promptDialog.sendKeys(authenticatorLabel);
promptDialog.accept();
waitForPageToLoad();
}
Aggregations