I have a python script that does some GUI test on a chromium application. Sometimes this application does not load up correctly and for this reason the GUI test will not pass, but a simple restart of this application can fix the problem.
What I currently have is something like this:
def test():
...do some settings...
...SystemOperator.restartController()...
...Login(My.PinCode)...
...GoToDeviceUI()...
...undo settings...
...SystemOperator.restartController()...
When doing this login, in case the app did not load correctly an exception is thrown and my test is failing.
What I want to do is something like this:
def test():
def testBody():
...do some settings...
...SystemOperator.restartController()...
...Login(My.PinCode)...
...GoToDeviceUI()...
...undo settings...
...SystemOperator.restartController()...
try_cnt = 3
for i in range(try_cnt):
try:
testBody()
break
except:
...SystemOperator.restartController()...
But without using a for/while loop.
Thank you!