def tearDown(self):
    if sys.exc_info()[0]:
        fail_url = self.driver.current_url
print(fail_url)
now = datetime.now().strftime('%Y-%m-%d_%H-%M-%S-%f')
self.driver.get_screenshot_as_file('/path/to/file/%s.png' % now)
fail_screenshot_url = 'http://debugtool/screenshots/%s.png' % now
print(fail_screenshot_url)
self.driver.quit()
How do I capture a screenshot if my nosetests fail?