Alerts are pop up's that appear on the browser window based on a specific user action which is "Click"
There are 3 types of alerts.
- Simple alerts with alert text, Ok button
- Confirm alerts with alert text, Ok & Cancel button
- Prompt alerts with alert text box, Ok & Cancel button
Note:
The way cypress are handled in cypress aren't the same way just like in case of Selenium.
In Selenium, Where there is a pop up alert on the screen.
The user should navigate to the alert pop to perform action.
But, In cypress simple alerts are handled by default as its one of the in-built capabilities of Cypress.
Cypress for now directly supports simple and confirm alerts.
Where as for prompt based alerts, One must use cy.window() with a then call back function along with a stub to handle it.
Example:
Top comments (0)