def screenshots(self, describe=None): """ A screenshot that adds a watermark to the corresponding element """ global driver w, h = self.center() screenshots_dir = screenshots_name(describe) driver.screenshot(screenshots_dir) processing(screenshots_dir, w, h)
def screenshots(w=None, h=None, describe=None): """ 截图 """ global driver screenshots_dir = screenshots_name(describe) driver.screenshot().save(screenshots_dir) multiple = driver.scale w, h = multiple * w, multiple * h processing(screenshots_dir, w, h)
def screenshots(self, w=None, h=None, describe=None): """ 截图 """ if w is not None and h is not None: if float(w) < 1 and float(h) < 1: multiple = self.driver.scale w, h = multiple * w, multiple * h screenshots_dir = screenshots_name(describe) self.driver.screenshot().save(screenshots_dir) processing(screenshots_dir, w, h)
def screenshots(self, w=None, h=None, describe=None): """ 截图 """ if w and h: if w < 1 and h < 1: x, y = self.window_size() w, h = x * w, y * h screenshots_dir = screenshots_name(describe) self.driver.screenshot(screenshots_dir) processing(screenshots_dir, w, h)
def screenshots(self, describe=None): """ 截图,在对应元素上增加水印 """ global driver text = driver.xpath(self.xpath).get_text() if text == "": w, h = None, None else: w, h = driver(text=text).center() screenshots_dir = screenshots_name(describe) driver.screenshot(screenshots_dir) processing(screenshots_dir, w, h)