def move_slider(self, slider, offset=0.0):
"""Click somewhere in an horizontal slider. The position is given in fraction
of its width: *offset* from 0 to 1."""
width = slider.size['width']
action_chains = ActionChains(self.driver)
# Move to the middle of the slider (default), then to its leftmost point
action_chains.move_to_element(slider).move_by_offset(-width/2.0, 0)
# Double-click twice to know where the cursor is.
#action_chains.context_click().context_click()
# Need to perform() because it seems to bug with move_by_offset otherwise
action_chains.perform()
# Offset to the right
action_chains.move_by_offset(width * offset, 0)
# Double-click twice to know where the cursor is
#action_chains.context_click().context_click()
action_chains.click().perform()
评论列表
文章目录