class Selenium::WebDriver::Interactions::PointerPress

Constants

BUTTONS
DIRECTIONS

Public Class Methods

new(source, direction, button) click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 71
def initialize(source, direction, button)
  super(source)
  @direction = assert_direction(direction)
  @button = assert_button(button)
end

Public Instance Methods

assert_button(button) click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 81
def assert_button(button)
  if button.is_a? Symbol
    raise TypeError, "#{button.inspect} is not a valid button!" unless BUTTONS.key? button

    button = BUTTONS[button]
  end
  raise ArgumentError, 'Button number cannot be negative!' unless button >= 0

  button
end
assert_direction(direction) click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 92
def assert_direction(direction)
  raise TypeError, "#{direction.inspect} is not a valid button direction" unless DIRECTIONS.key? direction

  DIRECTIONS[direction]
end
encode() click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 98
def encode
  {type: type, button: @button}
end
type() click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 77
def type
  @direction
end