How to handle application confirmations
This example demonstrates handling the confirmation dialog box/pop up.
In the solution shown below, you will click on the button "Click for JS Confirm" which will display a java script confirmation with the value "I am a JS Confirm." in the Worksoft SaaS Training application. For any confirmation pop ups/dialog boxes, you can either accept the confirmation or cancel/decline the confirmation depending on your requirement.
Solution:
# | Command | Target | Value |
---|---|---|---|
To accept a confirmation, click on OK | |||
1 | chooseOkOnNextConfirmation | ||
Click on the button "Click for JS Confirm" | |||
2 | click | //button[.='Click for JS Confirm'] | |
Handle the confirmation to accept the message | |||
3 | assertConfirmation |
I am a JS Confirm. | |
To decline/cancel a confirmation | |||
4 | chooseCancelOnNextConfirmation |
||
Click on the button "Click for JS Confirm" | |||
5 | click | //button[.='Click for JS Confirm'] | |
Handle the confirmation to decline/cancel the message | |||
6 | assertConfirmation |
I am a JS Confirm. |
Tips, Tricks, Gotcha's & Best Practices:
- As an alternative, you can also use the waitForConfirmation or verifyConfirmation commands to handle the confirmation popup.