123456789_123456789_123456789_123456789_123456789_

Class: Selenium::WebDriver::Interactions::PointerPress Private

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

Overview

Actions related to clicking, tapping or pressing the pointer.

Constant Summary

PointerEventProperties - Included

VALID

Class Method Summary

Instance Attribute Summary

Interaction - Inherited

Instance Method Summary

PointerEventProperties - Included

Interaction - Inherited

Constructor Details

.new(source, direction, button, **opts) ⇒ PointerPress

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_press.rb', line 44

def initialize(source, direction, button, **opts)
  super(source)
  @direction = assert_direction(direction)
  @button = assert_button(button)
  @type = @direction
  @opts = opts
end

Instance Method Details

#assert_button(button) (private)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_press.rb', line 62

def assert_button(button)
  case button
  when Symbol
    raise ArgumentError, "#{button} is not a valid button!" unless BUTTONS.key? button

    BUTTONS[button]
  when Integer
    raise ArgumentError, 'Button number cannot be negative!' if button.negative?

    button
  else
    raise TypeError, "button must be a positive integer or one of #{BUTTONS.keys}, not #{button.class}"
  end
end

#assert_direction(direction) (private)

Raises:

  • (ArgumentError)
[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_press.rb', line 77

def assert_direction(direction)
  raise ArgumentError, "#{direction.inspect} is not a valid button direction" unless DIRECTIONS.key? direction

  DIRECTIONS[direction]
end

#assert_source(source) (private)

Raises:

  • (TypeError)
[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_press.rb', line 58

def assert_source(source)
  raise TypeError, "#{source.type} is not a valid input type" unless source.is_a? PointerInput
end

#encode

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_press.rb', line 52

def encode
  process_opts.merge('type' => type.to_s, 'button' => @button)
end