Class: Selenium::WebDriver::Interactions::PointerInput Private

Inherits:
InputDevice
  • Object
show all
Defined in:
rb/lib/selenium/webdriver/common/interactions/pointer_input.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Creates actions specific to Pointer Input devices

Constant Summary collapse

KIND =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{mouse: :mouse, pen: :pen, touch: :touch}.freeze

Instance Attribute Summary collapse

Attributes inherited from InputDevice

#actions, #name, #type

Instance Method Summary collapse

Methods inherited from InputDevice

#add_action, #clear_actions, #create_pause

Constructor Details

#initialize(kind, name: nil) ⇒ PointerInput

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PointerInput.



34
35
36
37
38
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_input.rb', line 34

def initialize(kind, name: nil)
  super(name)
  @kind = assert_kind(kind)
  @type = Interactions::POINTER
end

Instance Attribute Details

#kindObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_input.rb', line 32

def kind
  @kind
end

Instance Method Details

#assert_kind(pointer) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (TypeError)


46
47
48
49
50
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_input.rb', line 46

def assert_kind(pointer)
  raise TypeError, "#{pointer.inspect} is not a valid pointer type" unless KIND.key? pointer

  KIND[pointer]
end

#create_pointer_cancelObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



64
65
66
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_input.rb', line 64

def create_pointer_cancel
  add_action(PointerCancel.new(self))
end

#create_pointer_down(button, **opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



56
57
58
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_input.rb', line 56

def create_pointer_down(button, **opts)
  add_action(PointerPress.new(self, :down, button, **opts))
end

#create_pointer_move(duration: 0, x: 0, y: 0, origin: nil, **opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_input.rb', line 52

def create_pointer_move(duration: 0, x: 0, y: 0, origin: nil, **opts)
  add_action(PointerMove.new(self, duration, x, y, origin: origin, **opts))
end

#create_pointer_up(button, **opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



60
61
62
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_input.rb', line 60

def create_pointer_up(button, **opts)
  add_action(PointerPress.new(self, :up, button, **opts))
end

#encodeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
43
44
# File 'rb/lib/selenium/webdriver/common/interactions/pointer_input.rb', line 40

def encode
  output = super
  output[:parameters] = {pointerType: kind} if output
  output
end