Py.test automatic Selenium screenshot
You can write simple pytest hook to take Selenium webdriver screenshots
automatically each time test fail.
It recognize Selenium tests by fixture name browser
so if you use
another name for Selenuim webdrive you should change it.
Full tests code you can find on github
If you use allure you can nicely attach the screenshots to test report as show in code below.
The result would be like on picture above.
In my article I explain how you can set up powerful test infrastructure in no time.