Exemple #1
0
 def save_screenshot(self):
     screenshot_dir = os.path.join(self.marionette.instance.workspace or '',
                                   'screenshots')
     filename = ''.join(
         [self.id().replace(' ', '-'), '_',
          str(timestamp_now()), '.png'])
     path = os.path.join(screenshot_dir, filename)
     if not os.path.exists(screenshot_dir):
         os.makedirs(screenshot_dir)
     with self.marionette.using_context('content'):
         img_data = self.marionette.screenshot()
     with open(path, 'wb') as f:
         f.write(img_data.decode('base64'))
     self.marionette.log('Screenshot saved in %s' % os.path.abspath(path))
Exemple #2
0
 def save_screenshot(self):
     """
     Make a screenshot of the window that is currently playing the video
     element.
     """
     screenshot_dir = os.path.join(self.marionette.instance.workspace or "", "screenshots")
     filename = "".join([self.id().replace(" ", "-"), "_", str(timestamp_now()), ".png"])
     path = os.path.join(screenshot_dir, filename)
     if not os.path.exists(screenshot_dir):
         os.makedirs(screenshot_dir)
     with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
         img_data = self.marionette.screenshot()
     with open(path, "wb") as f:
         f.write(img_data.decode("base64"))
     self.marionette.log("Screenshot saved in {}".format(os.path.abspath(path)))
Exemple #3
0
 def save_screenshot(self):
     screenshot_dir = os.path.join(self.marionette.instance.workspace or '',
                                   'screenshots')
     filename = ''.join([self.id().replace(' ', '-'),
                         '_',
                         str(timestamp_now()),
                         '.png'])
     path = os.path.join(screenshot_dir, filename)
     if not os.path.exists(screenshot_dir):
         os.makedirs(screenshot_dir)
     with self.marionette.using_context('content'):
         img_data = self.marionette.screenshot()
     with open(path, 'wb') as f:
         f.write(img_data.decode('base64'))
     self.marionette.log('Screenshot saved in %s' % os.path.abspath(path))
Exemple #4
0
 def save_screenshot(self):
     """
     Make a screenshot of the window that is currently playing the video
     element.
     """
     screenshot_dir = os.path.join(self.marionette.instance.workspace or '',
                                   'screenshots')
     filename = ''.join(
         [self.id().replace(' ', '-'), '_',
          str(timestamp_now()), '.png'])
     path = os.path.join(screenshot_dir, filename)
     if not os.path.exists(screenshot_dir):
         os.makedirs(screenshot_dir)
     with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
         img_data = self.marionette.screenshot()
     with open(path, 'wb') as f:
         f.write(img_data.decode('base64'))
     self.marionette.log('Screenshot saved in {}'.format(
         os.path.abspath(path)))
Exemple #5
0
 def save_screenshot(self):
     """
     Make a screenshot of the window that is currently playing the video
     element.
     """
     screenshot_dir = os.path.join(self.marionette.instance.workspace or '',
                                   'screenshots')
     filename = ''.join([self.id().replace(' ', '-'),
                         '_',
                         str(timestamp_now()),
                         '.png'])
     path = os.path.join(screenshot_dir, filename)
     if not os.path.exists(screenshot_dir):
         os.makedirs(screenshot_dir)
     with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
         img_data = self.marionette.screenshot()
     with open(path, 'wb') as f:
         f.write(img_data.decode('base64'))
     self.marionette.log('Screenshot saved in %s' % os.path.abspath(path))