I am working on an automation process that involves UI interaction with a web-based application. But sometimes, there might be a situation where some sort of warning/information/notification error might pop up in between the operation which potentially leads to the process failure.
In order to give you a picture:
→ The popup might contain an ‘X’ button to close it.
→ The popup might contain a ‘Close’ button to close it.
→ The popup might contain an ‘OK’ button to close it.
→ The popup might contain an ‘I Agree’ button to proceed.
Basically, the nature, position & characteristics of the popups are unknown.
Is there any generalized way to deal with this use case, so the popups can be tackled & the automation won’t break?
Use global exception handler with check app state to check for existance of any of these pop ups…if present then click and handle it …and retry current step
Else if non are found then just throw the error as any other error needs to be thrown
We could try analysing the Selectors for each of the popup and come to a conclusion whether a Single Click could be possible with maybe Regex Expression involved within the Selectors.
Are there only 4 types of popups that appear ?
Also, Do we know at what steps do these pop ups occur or is it random ?
The popups are so random that we might not be able to get a generalized regex-based selector to handle this, given that more popups might be added later. As of now, we are getting some popups in the specific steps, which are handled right away, but announcements from the website end or any other notifications might break the automation in our case.
One to click on the first button in the pop up we get…let it be ok,I agree ,etcc…
Because generally first button will be these and the second will be cancel,no etc
So we can use two selectors in general one for click on close (x) and other for any button with idx=‘1’ instead of name or inenrtext in it
Thanks for the insights. Generally speaking, most of the popups contain the ‘X’ button, will try to verify the same in my use case. If so, will go with the general selector as you suggested.
You can also consider if it is a good idea to write a handler that handles all unknown popups? Just as an example, a popup appears asking if you want to delete all the data of the transaction, and your handler clicks on “Yes”.
Of course, this is a stretched example, but it is an option to let the automation to fail until you have developed a handler for a new popup that appears.