def take_screenshot(): # need to set config directory sst.config.results_directory = here() tempFile = tempfile.NamedTemporaryFile(delete=False) logging.info('created named file %s' % tempFile.name) tempFile.close() ssta.take_screenshot(tempFile.name) screenshot = Screenshot(tempFile.name) os.unlink(tempFile.name) if os.path.exists(tempFile.name): logging.info('unable to delete temporary file %s' % tempFile.name) return screenshot
def take_screenshot_and_page_dump(self, exc_info): try: filename = 'screenshot-{0}.png'.format(self.id()) actions.take_screenshot(filename) except Exception: # FIXME: Needs to be reported somehow ? -- vila 2012-10-16 pass try: # also dump page source filename = 'pagesource-{0}.html'.format(self.id()) actions.save_page_source(filename) except Exception: # FIXME: Needs to be reported somehow ? -- vila 2012-10-16 pass
def take_screenshot_and_page_dump(self, exc_info): # FIXME: Urgh, config.results_directory is a global set in # runtests() -- vila 2012-10-29 try: filename = 'screenshot-{0}.png'.format(self.id()) actions.take_screenshot(filename) except Exception: # FIXME: Needs to be reported somehow ? -- vila 2012-10-16 pass try: # also dump page source filename = 'pagesource-{0}.html'.format(self.id()) actions.save_page_source(filename) except Exception: # FIXME: Needs to be reported somehow ? -- vila 2012-10-16 pass