class Marionette::ActionBuilder

Overview

ActionBuilder allows you to put together a custom sequence of actions to be performed in the given order. These actions can include clicks, pointer moves, and keyboard actions.

The easiest way to use ActionBuilder is through Session#actions and Session#perform_actions.

Defined in:

Constant Summary

DEBUG_MOUSE_MOVE_SCRIPT = {{ read_file("/home/watzon/Projects/personal/marionette/src/marionette/scripts/debug_mouse_move.js") }}

Constructors

Instance Method Summary

Constructor Detail

def self.new(session : Session, w3c_key_actions = [] of Action, w3c_pointer_actions = [] of Action, actions = [] of Tuple(String, Action)) #

Instance Method Detail

def action(command : String, action : Action) #

Add a non-W3C compatible action.


def actions : Array(Tuple(String, Action)) #

def clear_actions #

def click(selector : String, delta_x : Number, delta_y : Number, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def click(selector : String, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def click(button : MouseButton = :left) #

def click(element : Element, button : MouseButton = :left) #

def click_and_hold(selector : String, delta_x : Number, delta_y : Number, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def click_and_hold(button : MouseButton = :left) #

def click_and_hold(element : Element, button : MouseButton = :left) #

def click_and_hold(selector : String, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def create_key_down(key : Key | Char | String) #

Create a new KeyDown action with the given value


def create_key_up(key : Key | Char | String) #

Create a new KeyUp action with the given value


def create_mouse_down(button : MouseButton, duration : Time::Span = 0.seconds) #

Create a new PointerDown action for the given button with the given click duration.


def create_mouse_up(button : MouseButton, duration : Time::Span = 0.seconds) #

Create a new PointerUp action for the given button with the given click duration.


def create_pointer_move(x : Number, y : Number, duration : Time::Span = 0.seconds, origin = Origin::ViewPort.new) #

def create_pointer_move(x : Number, y : Number, element : Element, duration : Time::Span = 0.seconds) #

def create_pointer_move(selector : String, duration : Time::Span = 0.seconds, location_strategy : LocationStrategy = :css) #

def create_pointer_move(element : Element, duration : Time::Span = 0.seconds) #

def create_pointer_move(x : Number, y : Number, selector : String, duration : Time::Span = 0.seconds, location_strategy : LocationStrategy = :css) #

def double_click(selector : String, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def double_click(button : MouseButton = :left) #

def double_click(selector : String, delta_x : Number, delta_y : Number, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def double_click(element : Element, button : MouseButton = :left) #

def double_right_click(element : Element) #

def double_right_click #

def double_right_click(selector : String, delta_x : Number, delta_y : Number, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def double_right_click(selector : String, location_strategy : LocationStrategy = :css) #

def drag_and_drop(source : Element, dest : Element) #

def drag_and_drop(source : Element, delta_x : Number, delta_y : Number) #

def drag_and_drop(selector : String, delta_x : Number, delta_y : Number, location_strategy : LocationStrategy = :css) #

def drag_and_drop(source : String, dest : String, location_strategy : LocationStrategy = :css) #

def key_down(key : Key | Char) #

def key_down(key : Key | Char, element : Element) #

def key_down(key : Key | Char, selector : String, location_strategy : LocationStrategy = :css) #

def key_up(key : Key | Char) #

def key_up(key : Key | Char, selector : String, location_strategy : LocationStrategy = :css) #

def mouse_button_down(button : MouseButton = :left, duration : Time::Span = 0.seconds) #

Create a mouse down action and add it dependant on the W3C status of the current WebDriver.


def mouse_button_up(button : MouseButton = :left, duration : Time::Span = 0.seconds) #

Create a mouse up action and add it dependant on the W3C status of the current WebDriver.


def move_mouse(x : Number, y : Number, duration : Time::Span = 0.seconds, origin = Origin::ViewPort.new) #

def move_mouse_by(delta_x : Number, delta_y : Number, duration : Time::Span) #

def move_mouse_by(delta_x : Number, delta_y : Number) #

def move_mouse_to(x : Number, y : Number, duration : Time::Span = 0.seconds) #

def move_mouse_to(selector : String, delta_x : Number, delta_y : Number, location_strategy : LocationStrategy = :css) #

def move_mouse_to(element : Element, delta_x : Number, delta_y : Number) #

def move_mouse_to(selector : String, duration : Time::Span = 0.seconds, location_strategy : LocationStrategy = :css) #

def move_mouse_to(element : Element, duration : Time::Span = 0.seconds) #

def move_mouse_to(selector : String, location_strategy : LocationStrategy = :css) #

def pause(duration : Time::Span = 0.seconds) #

def perform(debug_mouse_move = false) #

def release(selector : String, delta_x : Number, delta_y : Number, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def release(selector : String, button : MouseButton = :left, location_strategy : LocationStrategy = :css) #

def release(button : MouseButton = :left) #

def release_right(selector : String, delta_x : Number, delta_y : Number, location_strategy : LocationStrategy = :css) #

def release_right(selector : String, location_strategy : LocationStrategy = :css) #

def release_right #

def reset_actions #

def right_click #

def right_click(selector : String, delta_x : Number, delta_y : Number, location_strategy : LocationStrategy = :css) #

def right_click(selector : String, location_strategy : LocationStrategy = :css) #

def right_click(element : Element) #

def right_click_and_hold #

def right_click_and_hold(selector : String, delta_x : Number, delta_y : Number, location_strategy : LocationStrategy = :css) #

def right_click_and_hold(selector : String, location_strategy : LocationStrategy = :css) #

def right_click_and_hold(element : Element) #

def send_keys(selector : String, keys : Array(Key | Char | String)) #

def send_keys(element : Element, keys : Array(Key | Char | String)) #

def send_keys(keys : Array(Key | Char | String)) #

def session : Session #

def w3c_action(action : Action) #

Add a new W3C compatible action and add a pause of the opposite type to keep ticks aligned.


def w3c_key_actions : Array(Action) #

def w3c_pointer_actions : Array(Action) #