Skip to content

Instantly share code, notes, and snippets.

@AutomatedTester
Created June 10, 2013 17:02
Show Gist options
  • Select an option

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

Select an option

Save AutomatedTester/5750415 to your computer and use it in GitHub Desktop.
from marionette import Marionette, Actions, MultiActions
import time
# Setup boilerplate:
m = Marionette()
m.start_session()
m.switch_to_frame(2)
# choose a photo
lis = m.find_elements("tag name", "li")
lis[0].tap()
imgs = m.find_elements("tag name", "img")
our_image = imgs[2]
# pause a second
time.sleep(1)
# zoom
# Finger 1
action1 = Actions(m)
action1.press(our_image, 150, 50).move_by_offset(10, 0).wait(0.2).move_by_offset(10, 0).wait(0.2).move_by_offset(10,0).wait(0.2).move_by_offset(10,0).release()
# Finger 2
action2 = Actions(m)
action2.press(our_image, 160, 50).move_by_offset(-10, 0).wait(0.2).move_by_offset(-10, 0).wait(0.2).move_by_offset(-10,0).wait(0.2).move_by_offset(-10,0).release()
# add both fingers and perform
multi = MultiActions(m)
multi.add(action1).add(action2).perform()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment