class Selenium::WebDriver::Interactions::PointerInput

Constants

KIND

Attributes

kind[R]

Public Class Methods

new(kind, name: nil) click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 27
def initialize(kind, name: nil)
  super(name)
  @kind = assert_kind(kind)
end

Public Instance Methods

assert_kind(pointer) click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 44
def assert_kind(pointer)
  raise TypeError, "#{pointer.inspect} is not a valid pointer type" unless KIND.key? pointer

  KIND[pointer]
end
create_pointer_cancel() click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 62
def create_pointer_cancel
  add_action(PointerCancel.new(self))
end
create_pointer_down(button) click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 54
def create_pointer_down(button)
  add_action(PointerPress.new(self, :down, button))
end
create_pointer_move(duration: 0, x: 0, y: 0, element: nil, origin: nil) click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 50
def create_pointer_move(duration: 0, x: 0, y: 0, element: nil, origin: nil)
  add_action(PointerMove.new(self, duration, x, y, element: element, origin: origin))
end
create_pointer_up(button) click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 58
def create_pointer_up(button)
  add_action(PointerPress.new(self, :up, button))
end
encode() click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 36
def encode
  return nil if no_actions?

  output = {type: type, id: name, actions: @actions.map(&:encode)}
  output[:parameters] = {pointerType: kind}
  output
end
type() click to toggle source
# File lib/selenium/webdriver/common/interactions/pointer_input.rb, line 32
def type
  Interactions::POINTER
end