def long_press(self, elem, x, y, duration): """ appium API Begin a chain with a press down that lasts `duration` milliseconds """ action = MobileTouchAction(self.driver) action.long_press(elem, x, y, duration).perform()
def top(self, elem, x, y, count): """ appium API Perform a tap action on the element """ action = MobileTouchAction(self.driver) action.tap(elem, x, y, count).perform()
def press(self, elem, x, y, pressure): """ appium API Begin a chain with a press down action at a particular element or point """ action = MobileTouchAction(self.driver) action.press(elem, x, y, pressure).perform()
def tap(self, elem=None, x=0, y=0, count=1): """ appium API Perform a tap action on the element """ self.switch_to_app() if elem: action = MobileTouchAction(self.driver) action.tap(elem, x, y, count).perform() else: self.driver.tap([(x, y)]) logger.info('点击坐标(%d,%d)' % (x, y)) self.switch_to_web()