Action Sequences

Actions are designed as a way to simulate user input as closely as possible on a touch device like a smart phone. A common operation is to tap the screen and drag your finger to another part of the screen and lift it off.

This can be simulated using an Action:

from marionette_driver.marionette import Actions

start_element = marionette.find_element('id', 'start')
end_element = marionette.find_element('id', 'end')

action = Actions(marionette)

This will simulate pressing an element, waiting for one second, moving the finger over to another element and then lifting the finger off the screen. The wait is optional in this case, but can be useful for simulating delays typical to a users behaviour.

Multi-Action Sequences

Sometimes it may be necessary to simulate multiple actions at the same time. For example a user may be dragging one finger while tapping another. This is where MultiActions come in. MultiActions are simply a way of combining two or more actions together and performing them all at the same time:

from marionette_driver.marionette import Actions, MultiActions

action1 = Actions(marionette)

action2 = Actions(marionette)

multi = MultiActions(marionette)