def swipe_right(): """右滑.""" end_x = start_x + ratio * width if end_x > width: logger.warning(u'右滑距离过大') return False else: driver.swipe(start_x, start_y, end_x, start_y, duration) return True
def swipe_down(): """下滑.""" end_y = start_y + ratio * height if end_y > height: logger.warning(u'下滑距离过大') return False else: driver.swipe(start_x, start_y, start_x, end_y, duration) return True
def swipe_left(): """左滑.""" end_x = start_x - ratio * width if end_x < 0: logger.warning(u'左滑距离过大') return False else: driver.swipe(start_x, start_y, end_x, start_y, duration) return True
def swipe_up(): """上滑.""" end_y = start_y - ratio * height if end_y < 0: logger.warning(u'上滑距离过大') return False else: driver.swipe(start_x, start_y, start_x, end_y, duration) return True