Posted On: Jan 11, 2021
You can cancel Alert in Protractor by using dismiss() as follows:
The dismiss() method is used to cancel the alert for handling alerts in Selenium. It is functional for all alert types: prompt, alert, and confirmation dialogue box.
driver.switchTo().alert().dismiss(); It activates by clicking on the “X” button in the prompt.
You can accept Alert in Protractor by using accept() as follows:
var myAlert = browser.switchTo().alert(); myAlert.accept(); Click on the 'OK' button will confirm the action
Never Miss an Articles from us.