This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void alerts() { | |
driver.get("https://the-internet.herokuapp.com/javascript_alerts"); | |
driver.findElement(By.xPath("//*[contains(normalize-space(text()), 'Click for JS Alert')]")).click(); | |
driver.switchTo().alert().accept(); | |
driver.findElement(By.xPath("//*[contains(normalize-space(text()), 'Click for JS Prompt')]")).click(); | |
Alert inputAlert = driver.switchTo().alert(); | |
String text = inputAlert.getText(); | |
inputAlert.sendKeys("Look Mom! I can automate alerts :) "); | |
inputAlert.accept(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment