123456789_123456789_123456789_123456789_123456789_

Class: Selenium::WebDriver::Interactions::InputDevice Private

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: rb/lib/selenium/webdriver/common/interactions/input_device.rb

Overview

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

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name = nil) ⇒ InputDevice

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/input_device.rb', line 35

def initialize(name = nil)
  @name = name || SecureRandom.uuid
  @actions = []
end

Instance Attribute Details

#actions (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/input_device.rb', line 33

attr_reader :name, :actions, :type

#name (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/input_device.rb', line 33

attr_reader :name, :actions, :type

#type (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/input_device.rb', line 33

attr_reader :name, :actions, :type

Instance Method Details

#add_action(action)

Raises:

  • (TypeError)
[ GitHub ]

  
# File 'rb/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

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/input_device.rb', line 46

def clear_actions
  @actions.clear
end

#create_pause(duration = 0)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/input_device.rb', line 50

def create_pause(duration = 0)
  add_action(Pause.new(self, duration))
end

#encode

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/input_device.rb', line 54

def encode
  {type: type, id: name, actions: @actions.map(&:encode)} unless @actions.empty?
end