def input(self, ele, text): """ 输入 """ # 截图,画方块 png_log_path = self.get_next_png_path() self.driver.save_screenshot(png_log_path) draw_rec( png_log_path, png_log_path, (ele.location["x"] + ele.size["width"] / 2, ele.location["y"] + ele.size["height"] / 2), ) # 输入 self.log("input : " + text) ele.send_keys(text)
def tap_on_id(self, id): """ 点击ID的ele """ ele = self.find_element_by_id(id) # 截图,画方块 png_log_path = self.get_next_png_path() self.driver.save_screenshot(png_log_path) draw_rec( png_log_path, png_log_path, (ele.location["x"] + ele.size["width"] / 2, ele.location["y"] + ele.size["height"] / 2), ) self.log("Tap on id : " + str(id)) self.action.tap(ele).perform()
def tap_on_ele(self, ele): """ Tap on a element """ # 截图,画方块 png_log_path = self.get_next_png_path() self.driver.save_screenshot(png_log_path) draw_rec( png_log_path, png_log_path, (ele.location["x"] + ele.size["width"] / 2, ele.location["y"] + ele.size["height"] / 2), ) # 执行点击 self.log("Tap on ele : " + str(ele.location)) self.action.tap(ele).perform()
def tap_on_text(self, p_text): """ Tap on text. """ ele = self.find_element_by_text(p_text) # 截图,画方块 png_log_path = self.get_next_png_path() self.driver.save_screenshot(png_log_path) draw_rec( png_log_path, png_log_path, (ele.location["x"] + ele.size["width"] / 2, ele.location["y"] + ele.size["height"] / 2), ) # 执行点击 self.log("Tap on text : " + p_text) self.action.tap(ele).perform()