Class: Selenium::WebDriver::Interactions::InputDevice
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Interactions::InputDevice
- Defined in:
- lib/selenium/webdriver/common/interactions/input_device.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add_action(action) ⇒ Object
- #clear_actions ⇒ Object
- #create_pause(duration = nil) ⇒ Object
-
#initialize(name = nil) ⇒ InputDevice
constructor
A new instance of InputDevice.
-
#no_actions? ⇒ Boolean
Determine if only pauses are present.
Constructor Details
#initialize(name = nil) ⇒ InputDevice
Returns a new instance of InputDevice.
26 27 28 29 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 26 def initialize(name = nil) @name = name || SecureRandom.uuid @actions = [] end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
24 25 26 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 24 def actions @actions end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 24 def name @name end |
Instance Method Details
#add_action(action) ⇒ Object
31 32 33 34 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 31 def add_action(action) raise TypeError, "#{action.inspect} is not a valid action" unless action.class < Interaction @actions << action end |
#clear_actions ⇒ Object
36 37 38 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 36 def clear_actions @actions.clear end |
#create_pause(duration = nil) ⇒ Object
40 41 42 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 40 def create_pause(duration = nil) add_action(Pause.new(self, duration)) end |
#no_actions? ⇒ Boolean
Determine if only pauses are present
44 45 46 47 |
# File 'lib/selenium/webdriver/common/interactions/input_device.rb', line 44 def no_actions? # Determine if only pauses are present actions = @actions.reject { |action| action.type == Interaction::PAUSE } actions.empty? end |