Skip to content

Try-except doesn't work as intended (failing my try on purpes but it doesnt do the except) #2173

Answered by mdmintz
elnatan2604 asked this question in Q&A
Discussion options

You must be logged in to vote

That looks like a Python question and not a SeleniumBase one. (Also, your code should be formatted as code with proper line indentation so that it makes sense.)

Here's how a try/except block works:

try:
    raise Exception("Fail!")
except Exception:
    print("Caught!")

After the exception is caught in the try block, the program continues from the except block.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants