How to capture screenshot on test case failure for Python Unittest
问题 I am using Python 3.6.5 with the following libraries: Appium-Python-Client==0.26 unittest2==1.1.0 selenium==3.5.0 pytest==3.6.3 Now I need to capture the screenshot in case of test failure, So intentionally I did put a false statement self.driver.find_element_by_css_selector('test') . I am using sys.exc_info() . But when I executing below code using a command: py.test untitled.py or python3 -m unittest untitled.py it does not capturing it. Code: import sys, time, unittest2 from selenium