def _screenshot(self, marionette, url, timeout): marionette.navigate(url) marionette.execute_async_script(self.wait_script) screenshot = marionette.screenshot() # strip off the data:img/png, part of the url if screenshot.startswith("data:image/png;base64,"): screenshot = screenshot.split(",", 1)[1] return screenshot
def _screenshot(self, marionette, url, timeout): try: marionette.navigate(url) except errors.MarionetteException: raise ExecutorException("ERROR", "Failed to load url %s" % (url,)) marionette.execute_async_script(self.wait_script) screenshot = marionette.screenshot() # strip off the data:img/png, part of the url if screenshot.startswith("data:image/png;base64,"): screenshot = screenshot.split(",", 1)[1] return screenshot
def _screenshot(self, marionette, url, timeout): try: marionette.navigate(url) except errors.MarionetteException: raise ExecutorException("ERROR", "Failed to load url %s" % (url, )) marionette.execute_async_script(self.wait_script) screenshot = marionette.screenshot() # strip off the data:img/png, part of the url if screenshot.startswith("data:image/png;base64,"): screenshot = screenshot.split(",", 1)[1] return screenshot
def do_testharness(self, marionette, url, timeout): if self.close_after_done: marionette.execute_script("if (window.wrappedJSObject.win) {window.wrappedJSObject.win.close()}") if timeout is not None: timeout_ms = str(timeout * 1000) else: timeout_ms = "null" script = self.script % {"abs_url": url, "url": strip_server(url), "window_id": self.window_id, "timeout_multiplier": self.timeout_multiplier, "timeout": timeout_ms, "explicit_timeout": timeout is None} return marionette.execute_async_script(script, new_sandbox=False)