Retry same findElement statement after handling unexpected popup

10 views
Skip to first unread message

rdnt...@gmail.com

unread,
May 11, 2018, 5:31:10 PM5/11/18
to Selenium Users
Hello, 

Problem :In my application, there is the unexpected popup shows up on any screen that makes test case fail. I can surround findelement with try-catch for most likely places but it may happen on any screen so this is not a good idea to cover every finelement statement with try-catch. 

Approach :  I would like to have mechanism if findlement is failed at any place due to unexpected pop up occurred, Framework should handle pop up and retry same find element statement one more time and return back to test execution to continue future steps.

After doing some research on Internet, I feel it can be done using WebDriverEventListener and tried but did not work. 

Solution/Suggestion: Can someone please provide me solution or suggestion how this can be achieved. 

I am using Java Selenium TestNG in Framework

Thank you

Reply all
Reply to author
Forward
0 new messages