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
-
BUTTONS =
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_press.rb', line 32{left: 0, touch: 0, pen_contact: 0, middle: 1, right: 2, pen_barrel: 2, x1: 3, back: 3, x2: 4, forward: 4}.freeze
-
DIRECTIONS =
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_press.rb', line 42{down: :pointerDown, up: :pointerUp}.freeze
PointerEventProperties
- Included
Class Method Summary
- .new(source, direction, button, **opts) ⇒ PointerPress constructor Internal use only
Interaction
- Inherited
Instance Attribute Summary
Interaction
- Inherited
Instance Method Summary
- #encode Internal use only
- #assert_button(button) private Internal use only
- #assert_direction(direction) private Internal use only
- #assert_source(source) private Internal use only
PointerEventProperties
- Included
Interaction
- Inherited
Constructor Details
.new(source, direction, button, **opts) ⇒ PointerPress
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_press.rb', line 44
def initialize(source, direction, , **opts) super(source) @direction = assert_direction(direction) @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 ( ) case when Symbol raise ArgumentError, "#{} is not a valid button!" unless BUTTONS.key? BUTTONS[ ] when Integer raise ArgumentError, 'Button number cannot be negative!' if .negative? else raise TypeError, "button must be a positive integer or one of #{BUTTONS.keys}, not #{ .class}" end end
#assert_direction(direction) (private)
# 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)
# 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