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



35
36
37
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 35

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

#create_key_up(key) ⇒ Object



39
40
41
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 39

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

#encodeObject



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

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

#typeObject



26
27
28
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 26

def type
  Interactions::KEY
end