I want to automatic capturing screenshots if my webdriver tests failed (any exception or assertion error). I am using Python unittest and Selenium Webdriver. Does anyone hav
You can start form exploring self._outcome.errors[1]
where it is possible to find information about the errors.
i.e. below code will work only for assertion errors
def tearDown(self):
if self._outcome.errors[1][1] and hasattr(self._outcome.errors[1][1][1], 'actual'):
self.driver.save_screenshot(self._testMethodName + '.png')