def _flick_to_image(self, direction): action = Actions(self.marionette) current_image = self.marionette.find_element(*self._current_image_locator) current_image_move_x = current_image.size["width"] / 2 current_image_mid_x = current_image.size["width"] / 2 current_image_mid_y = current_image.size["height"] / 2 if direction == "next": action.flick( current_image, current_image_mid_x, current_image_mid_y, current_image_mid_x - current_image_move_x, current_image_mid_y, ) else: action.flick( current_image, current_image_mid_x, current_image_mid_y, current_image_mid_x + current_image_move_x, current_image_mid_y, ) action.perform() self.wait_for_element_displayed(*self._current_image_locator)
def move_slider(self, slider, dir_x): scale = self.marionette.find_element(*slider) finger = Actions(self.marionette) finger.press(scale) finger.move_by_offset(dir_x, 0) finger.release() finger.perform() time.sleep(2)
def _flick_menu_down(self, locator): current_element = self.marionette.find_element(*self._current_element(*locator)) next_element = self.marionette.find_element(*self._next_element(*locator)) #TODO: update this with more accurate Actions action = Actions(self.marionette) action.press(current_element) action.move(next_element) action.release() action.perform()
def _flick_menu_down(self, locator): current_element = self.marionette.find_element(*self._current_element(*locator)) next_element = self.marionette.find_element(*self._next_element(*locator)) # TODO: update this with more accurate Actions action = Actions(self.marionette) action.press(current_element) action.move(next_element) action.release() action.perform()
def _flick_menu_up(self, locator): self.wait_for_element_displayed(*self._current_element(*locator)) current_element = self.marionette.find_element(*self._current_element(*locator)) next_element = self.marionette.find_element(*self._next_element(*locator)) #TODO: update this with more accurate Actions action = Actions(self.marionette) action.press(next_element) action.move(current_element) action.release() action.perform()
def _flick_to_image(self, direction): action = Actions(self.marionette) current_image = self.marionette.find_element(*self._current_image_locator) current_image_move_x = current_image.size['width'] / 2 current_image_mid_x = current_image.size['width'] / 2 current_image_mid_y = current_image.size['height'] / 2 if direction == 'next': action.flick(current_image, current_image_mid_x, current_image_mid_y, current_image_mid_x - current_image_move_x, current_image_mid_y) else: action.flick(current_image, current_image_mid_x, current_image_mid_y, current_image_mid_x + current_image_move_x, current_image_mid_y) action.perform() self.wait_for_element_displayed(*self._current_image_locator)
def _flick_to_month(self, direction): """Flick current monthly calendar to next or previous month. @param direction: flick to next month if direction='next', else flick to previous month """ action = Actions(self.marionette) current_monthly_calendar = self.marionette.find_element(*self._current_monthly_calendar_locator) flick_origin_x = current_monthly_calendar.size['width'] // 2 flick_origin_y = current_monthly_calendar.size['height'] // 2 flick_destination_x = 0 if direction == 'next' else 2 * flick_origin_x action.flick(current_monthly_calendar, flick_origin_x, flick_origin_y, flick_destination_x, flick_origin_y) action.perform()
def double_tap_image(self): image = self.marionette.find_element(*self._current_image_locator) action = Actions(self.marionette) action.double_tap(image) action.perform()