Class: Selenium::WebDriver::Interactions::KeyInput::TypingInteraction
- Inherits:
-
Interaction
- Object
- Interaction
- Selenium::WebDriver::Interactions::KeyInput::TypingInteraction
- Defined in:
- lib/selenium/webdriver/common/interactions/key_input.rb
Constant Summary
Constants inherited from Interaction
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Interaction
Instance Method Summary collapse
- #assert_type(type) ⇒ Object
- #encode ⇒ Object
-
#initialize(source, type, key) ⇒ TypingInteraction
constructor
A new instance of TypingInteraction.
Constructor Details
#initialize(source, type, key) ⇒ TypingInteraction
Returns a new instance of TypingInteraction.
46 47 48 49 50 |
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 46 def initialize(source, type, key) super(source) @type = assert_type(type) @key = Keys.encode_key(key) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type
44 45 46 |
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 44 def type @type end |
Instance Method Details
#assert_type(type) ⇒ Object
52 53 54 55 |
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 52 def assert_type(type) raise TypeError, "#{type.inspect} is not a valid key subtype" unless KeyInput::SUBTYPES.key? type KeyInput::SUBTYPES[type] end |
#encode ⇒ Object
57 58 59 |
# File 'lib/selenium/webdriver/common/interactions/key_input.rb', line 57 def encode {type: @type, value: @key} end |