Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
12-24-2023 08:48 AM
Hi,
I have a synthetic script that sometimes ends a run as a "broken job". I see in the documentation that this happens because of an unhandled exception.
So I added:
try:
....
wait.until(EC.element_to_be_clickable((By.ID, "username"))).click()
except Exception as e:
print ("The script threw an exception.")
But now, the script runs and if the job has a timeout exception the job status shows as "success", but I can see in the script output that it printed "The script threw an exception."
How do I make it so that if an exception is thrown the script status shows as failed?
Thanks,
Roberto
Solved! Go to Solution.
12-24-2023 06:24 PM
This may not be elegant... Try to include an assertion in the exception handling to see if it works:
except Exception as e:
print ("The script threw an exception.")
assert False,"other exception"
After the job ran, you will notice the session fails because of assertion failure.
regards,
Terence
12-26-2023 10:15 AM
Hi Terence,
Your solution seems to be working fine.
Thanks,
Roberto
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form