本文整理汇总了Python中marionette_driver.marionette.Actions.move_by_offset方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.move_by_offset方法的具体用法?Python Actions.move_by_offset怎么用?Python Actions.move_by_offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marionette_driver.marionette.Actions
的用法示例。
在下文中一共展示了Actions.move_by_offset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: move_seek_slider
# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import move_by_offset [as 别名]
def move_seek_slider(self, offset):
scale = self.marionette.find_element(*self._video_seek_head_locator)
finger = Actions(self.marionette)
finger.press(scale)
finger.move_by_offset(offset, 0)
finger.release()
finger.perform()
示例2: edge_scroll
# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import move_by_offset [as 别名]
def edge_scroll(self, frame, direction, dist, release=True):
"""edge scroll - performs task switching action.
direction = 'LtoR' or 'RtoL' (finger movement direction)
dist = percentage of horizontal distance travel, max is 1.0
release = if set to False, the Action object will be returned so the user can complete the release action"""
start_x = 0
dist_travelled = 0
time_increment = 0.01
if dist > 1:
dist = 1
if direction == 'LtoR':
start_x = 0
elif direction == 'RtoL':
start_x = frame.size['width']
dist *= -1 # travel opposite direction
limit = dist * frame.size['width']
dist_unit = limit * time_increment
action = Actions(self.marionette)
action.press(frame, start_x, frame.size['height'] / 2) # press either the left or right edge
while abs(dist_travelled) < abs(limit):
action.move_by_offset(dist_unit, 0)
action.wait(time_increment)
dist_travelled += dist_unit
if release:
action.release()
action.perform()
return action
示例3: move_slider
# 需要导入模块: from marionette_driver.marionette import Actions [as 别名]
# 或者: from marionette_driver.marionette.Actions import move_by_offset [as 别名]
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)