class Selenium::WebDriver::Interactions::PointerPress
def assert_button(button)
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
def assert_direction(direction)
def assert_direction(direction) raise ArgumentError, "#{direction.inspect} is not a valid button direction" unless DIRECTIONS.key? direction DIRECTIONS[direction] end
def assert_source(source)
def assert_source(source) raise TypeError, "#{source.type} is not a valid input type" unless source.is_a? PointerInput end
def encode
def encode process_opts.merge('type' => type.to_s, 'button' => @button) end
def initialize(source, direction, button, **opts)
def initialize(source, direction, button, **opts) super(source) @direction = assert_direction(direction) @button = assert_button(button) @type = @direction @opts = opts end