def SwipePage(self, left_start_ratio=0.5, top_start_ratio=0.5, direction='left', distance=100, speed_in_pixels_per_second=800, timeout=page_action.DEFAULT_TIMEOUT): """Perform swipe gesture on the page. Args: left_start_ratio: The horizontal starting coordinate of the gesture, as a ratio of the visible bounding rectangle for document.body. top_start_ratio: The vertical starting coordinate of the gesture, as a ratio of the visible bounding rectangle for document.body. direction: The direction of swipe, either 'left', 'right', 'up', or 'down' distance: The distance to swipe (in pixel). speed_in_pixels_per_second: The speed of the gesture (in pixels/s). """ self._RunAction( SwipeAction(left_start_ratio=left_start_ratio, top_start_ratio=top_start_ratio, direction=direction, distance=distance, speed_in_pixels_per_second=speed_in_pixels_per_second, timeout=timeout))
def SwipeElement(self, selector=None, text=None, element_function=None, left_start_ratio=0.5, top_start_ratio=0.5, direction='left', distance=100, speed_in_pixels_per_second=800): """Perform swipe gesture on the element. The element may be selected via selector, text, or element_function. Only one of these arguments must be specified. Args: selector: A CSS selector describing the element. text: The element must contains this exact text. element_function: A JavaScript function (as string) that is used to retrieve the element. For example: 'function() { return foo.element; }'. left_start_ratio: The horizontal starting coordinate of the gesture, as a ratio of the visible bounding rectangle for the element. top_start_ratio: The vertical starting coordinate of the gesture, as a ratio of the visible bounding rectangle for the element. direction: The direction of swipe, either 'left', 'right', 'up', or 'down' distance: The distance to swipe (in pixel). speed_in_pixels_per_second: The speed of the gesture (in pixels/s). """ self._RunAction(SwipeAction( selector=selector, text=text, element_function=element_function, left_start_ratio=left_start_ratio, top_start_ratio=top_start_ratio, direction=direction, distance=distance, speed_in_pixels_per_second=speed_in_pixels_per_second))