so have script in selenium, crashes various reasons. fails click button, gets confused, gets messed , displays error.
how can command script, whenever crashes, re-run script beginning again? i've heard try
, except
functions i'm not sure how use them.
any appreciated! :)
[using python 2.7 selenium webdriver]
generic answer retry on exception:
while true: try: # run selenium code breaks pass except exception e: print("something went wrong: "+repr(e))
you may try refine exception type avoid retrying say, because of python error valueerror
or ioerror
. check exception type , change exception
qualified type.
Comments
Post a Comment