class Selenium::WebDriver::Interactions::InputDevice

Superclass for the input device sources Manages Array of Interaction instances for the device

@api private

Attributes

actions[R]
name[R]
type[R]

Public Class Methods

new(name = nil) click to toggle source
# File lib/selenium/webdriver/common/interactions/input_device.rb, line 35
def initialize(name = nil)
  @name = name || SecureRandom.uuid
  @actions = []
end

Public Instance Methods

add_action(action) click to toggle source
# File lib/selenium/webdriver/common/interactions/input_device.rb, line 40
def add_action(action)
  raise TypeError, "#{action.inspect} is not a valid action" unless action.class < Interaction

  @actions << action
end
clear_actions() click to toggle source
# File lib/selenium/webdriver/common/interactions/input_device.rb, line 46
def clear_actions
  @actions.clear
end
create_pause(duration = 0) click to toggle source
# File lib/selenium/webdriver/common/interactions/input_device.rb, line 50
def create_pause(duration = 0)
  add_action(Pause.new(self, duration))
end
encode() click to toggle source
# File lib/selenium/webdriver/common/interactions/input_device.rb, line 54
def encode
  {type: type, id: name, actions: @actions.map(&:encode)} unless @actions.empty?
end