Skip to content

Commit d3a05c5

Browse files
committed
Add the "has_exception()" method for use in a tearDown() step
1 parent fcaba6c commit d3a05c5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6441,6 +6441,17 @@ def __create_log_path_as_needed(self, test_logpath):
64416441
except Exception:
64426442
pass # Only reachable during multi-threaded runs
64436443

6444+
def has_exception(self):
6445+
""" (This method should ONLY be used in custom tearDown() methods.)
6446+
This method returns True if the test failed or raised an exception.
6447+
This is useful for performing additional steps in your tearDown()
6448+
method (based on whether or not the test passed or failed).
6449+
Example use cases:
6450+
* Performing cleanup steps if a test didn't complete.
6451+
* Sending test data and/or results to a dashboard service.
6452+
"""
6453+
return self.__has_exception()
6454+
64446455
def save_teardown_screenshot(self):
64456456
""" (Should ONLY be used at the start of custom tearDown() methods.)
64466457
This method takes a screenshot of the current web page for a

0 commit comments

Comments
 (0)