I have a conflicting situation while testing a web app through python selenium. I get unexpected Error pop up windows (usually javascript errors). This can occur at any event of my test flow, I can handle the exceptions but the problem lies when returning back to the program flow after handling the exception.
For example:
class MyError:
def ErrorHandled(self):
print 'something'
try:
Line 1
Line2
Line3
Line4
except MyError:
pass
My issue here is while running the try block flow of statements; the MyError can occur anytime and any number of times. But it is not suppose to stop the execution of the code when it catches the Exception, I want it to resume back to the try statement.
If the Exception occurs after Line 2 and Line 3, the try block must be resumed to Line 4 and stop the execution of the code only when the try block completes its flow. How can I do this ?