Explain how you can handle a confirmation alert with "OK" and "Cancel" buttons in Appium.

  • driver.acceptAlert(); driver.dismissAlert(); driver.getAlertText(); driver.typeInAlert("input");
  • driver.alert().ok(); driver.alert().cancel(); driver.alert().text(); driver.alert().input("input");
  • driver.confirmAlert("OK"); driver.cancelAlert("Cancel"); driver.getTextFromAlert(); driver.sendInputToAlert("input");
  • driver.switchTo().alert().accept(); driver.switchTo().alert().dismiss(); driver.switchTo().alert().getText(); driver.switchTo().alert().sendKeys("input");
To handle a confirmation alert in Appium, you use driver.acceptAlert() for "OK" and driver.dismissAlert() for "Cancel." Retrieving text or providing input can be done using driver.getAlertText() and driver.typeInAlert("input").
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *