Class: Selenium::WebDriver::Interactions::TypingInteraction Private
- Inherits:
-
Interaction
- Object
- Interaction
- Selenium::WebDriver::Interactions::TypingInteraction
- Defined in:
- lib/selenium/webdriver/common/interactions/typing_interaction.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.
Actions related to pressing keys.
Direct Known Subclasses
Instance Attribute Summary collapse
- #type ⇒ Object readonly private
Instance Method Summary collapse
- #assert_source(source) ⇒ Object private
- #assert_type(type) ⇒ Object private
- #encode ⇒ Object private
-
#initialize(source, type, key) ⇒ TypingInteraction
constructor
private
A new instance of TypingInteraction.
Constructor Details
#initialize(source, type, key) ⇒ TypingInteraction
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 TypingInteraction.
32 33 34 35 36 |
# File 'lib/selenium/webdriver/common/interactions/typing_interaction.rb', line 32 def initialize(source, type, key) super(source) @type = assert_type(type) @key = Keys.encode_key(key) end |
Instance Attribute Details
#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.
30 31 32 |
# File 'lib/selenium/webdriver/common/interactions/typing_interaction.rb', line 30 def type @type end |
Instance Method Details
#assert_source(source) ⇒ 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.
38 39 40 |
# File 'lib/selenium/webdriver/common/interactions/typing_interaction.rb', line 38 def assert_source(source) raise TypeError, "#{source.type} is not a valid input type" unless source.is_a? KeyInput end |
#assert_type(type) ⇒ 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.
42 43 44 45 46 |
# File 'lib/selenium/webdriver/common/interactions/typing_interaction.rb', line 42 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
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.
48 49 50 |
# File 'lib/selenium/webdriver/common/interactions/typing_interaction.rb', line 48 def encode {type: @type, value: @key} end |