123456789_123456789_123456789_123456789_123456789_

Class: Selenium::WebDriver::Interactions::TypingInteraction Private

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Interaction
Instance Chain:
self, Interaction
Inherits: Selenium::WebDriver::Interactions::Interaction
Defined in: rb/lib/selenium/webdriver/common/interactions/typing_interaction.rb

Overview

Actions related to pressing keys.

Class Method Summary

Interaction - Inherited

Instance Attribute Summary

  • #type readonly Internal use only

Interaction - Inherited

Instance Method Summary

Interaction - Inherited

Constructor Details

.new(source, type, key) ⇒ TypingInteraction

[ GitHub ]

  
# File 'rb/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 (readonly)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/typing_interaction.rb', line 30

attr_reader :type

Instance Method Details

#assert_source(source)

Raises:

  • (TypeError)
[ GitHub ]

  
# File 'rb/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)

Raises:

  • (TypeError)
[ GitHub ]

  
# File 'rb/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

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/typing_interaction.rb', line 48

def encode
  {type: @type, value: @key}
end