Class: Selenium::WebDriver::Interactions::InputDevice Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Interactions::InputDevice
- Defined in:
- lib/selenium/webdriver/common/interactions/input_device.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Superclass for the input device sources Manages Array of Interaction instances for the device
Direct Known Subclasses
Instance Attribute Summary collapse
- #actions ⇒ Object readonly private
- #name ⇒ Object readonly private
- #type ⇒ Object readonly private
Instance Method Summary collapse
- #add_action(action) ⇒ Object private
- #clear_actions ⇒ Object private
- #create_pause(duration = 0) ⇒ Object private
- #encode ⇒ Object private
-
#initialize(name = nil) ⇒ InputDevice
constructor
private
A new instance of InputDevice.
Constructor Details
#initialize(name = nil) ⇒ InputDevice
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of InputDevice.
35 36 37 38 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 35 def initialize(name = nil) @name = name || SecureRandom.uuid @actions = [] end |
Instance Attribute Details
#actions ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 33 def actions @actions end |
#name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 33 def name @name end |
#type ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 33 def type @type end |
Instance Method Details
#add_action(action) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
40 41 42 43 44 |
# 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 ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
46 47 48 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 46 def clear_actions @actions.clear end |
#create_pause(duration = 0) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 50 def create_pause(duration = 0) add_action(Pause.new(self, duration)) end |
#encode ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
54 55 56 |
# 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 |