class Selenium::WebDriver::Interactions::TypingInteraction

Actions related to pressing keys.

@api private

Attributes

type[R]

Public Class Methods

new(source, type, key) click to toggle source
# 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

Public Instance Methods

assert_source(source) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/selenium/webdriver/common/interactions/typing_interaction.rb, line 48
def encode
  {type: @type, value: @key}
end