Skip to content

Instantly share code, notes, and snippets.

@AutomatedTester
Created June 10, 2013 16:55
Show Gist options
  • Select an option

  • Save AutomatedTester/5750380 to your computer and use it in GitHub Desktop.

Select an option

Save AutomatedTester/5750380 to your computer and use it in GitHub Desktop.
from marionette import Marionette, Actions, MultiActions
import time
#tested with 1.0.1 June 5
# setup boilerplate:
m = Marionette()
m.start_session()
m.switch_to_frame(2)
# Find the container element to dispatch scroll events to:
thumbnails = m.find_element("id", "thumbnails")
#scroll down
action = Actions(m)
action.press(thumbnails).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).wait(0.1).move_by_offset(0, -20).release().perform()
# pause before scrolling up
time.sleep(3)
# Note: once perform is called, chain of commands is cleared.
#scroll up
action.press(thumbnails).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).wait(0.1).move_by_offset(0, 20).release().perform()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment