I wonder if there is a way to capture any (and all) type of error that crashes the script, but potentially without using try
to catch a specific exception.
I have a webdriver script that does a lot of stuff, like clicks on links, sends keys and so on, but I cannot predict where it will crash. I want to run a series of tests in sequence and print results into a file - including any errors/crashes: Eg.
Test01 - Success!
Test02 - NameError: name 'driver' is not defined !ERROR!
Test03 - Success!
and so on.
So that at the end I can just open the text file and check which tests need to be fixed and re-run.
Now I've been using try/exception
with smaller blocks of code, but it seems to me that I would have to somehow include the whole script within try/catch/exception
to get what I want.
Is there a better way to catch any type of error that is displayed after a script crashes, like on the image below: