Class: Selenium::WebDriver::Interactions::KeyInput

Inherits:
InputDevice
  • Object
show all
Defined in:
lib/selenium/webdriver/common/interactions/key_input.rb

Defined Under Namespace

Classes: TypingInteraction

Constant Summary collapse

SUBTYPES =
{down: :keyDown, up: :keyUp, pause: :pause}.freeze

Instance Attribute Summary

Attributes inherited from InputDevice

#actions, #name

Instance Method Summary collapse

Methods inherited from InputDevice

#add_action, #clear_actions, #create_pause, #initialize, #no_actions?

Constructor Details

This class inherits a constructor from Selenium::WebDriver::Interactions::InputDevice

Instance Method Details

#create_key_down(key) ⇒ Object



33
34
35
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 33

def create_key_down(key)
  add_action(TypingInteraction.new(self, :down, key))
end

#create_key_up(key) ⇒ Object



37
38
39
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 37

def create_key_up(key)
  add_action(TypingInteraction.new(self, :up, key))
end

#encodeObject



28
29
30
31
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 28

def encode
  return nil if no_actions?
  {type: type, id: name, actions: @actions.map(&:encode)}
end

#typeObject



24
25
26
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 24

def type
  Interactions::KEY
end