{"record":{"id":"4c331f097bf8fec8","repo":"SeleniumHQ/selenium","slug":"pointer-inspect-is-not-a-valid-pointer-type","errorCode":null,"errorMessage":"#{pointer.inspect} is not a valid pointer type","messagePattern":"#(.+?) is not a valid pointer type","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/common/interactions/pointer_input.rb","lineNumber":47,"sourceCode":"      class PointerInput < InputDevice\n        KIND = {mouse: :mouse, pen: :pen, touch: :touch}.freeze\n\n        attr_reader :kind\n\n        def initialize(kind, name: nil)\n          super(name)\n          @kind = assert_kind(kind)\n          @type = Interactions::POINTER\n        end\n\n        def encode\n          output = super\n          output[:parameters] = {pointerType: kind} if output\n          output\n        end\n\n        def assert_kind(pointer)\n          raise TypeError, \"#{pointer.inspect} is not a valid pointer type\" unless KIND.key? pointer\n\n          KIND[pointer]\n        end\n\n        def create_pointer_move(duration: 0, x: 0, y: 0, origin: nil, **)\n          add_action(PointerMove.new(self, duration, x, y, origin: origin, **))\n        end\n\n        def create_pointer_down(button, **)\n          add_action(PointerPress.new(self, :down, button, **))\n        end\n\n        def create_pointer_up(button, **)\n          add_action(PointerPress.new(self, :up, button, **))\n        end\n\n        def create_pointer_cancel\n          add_action(PointerCancel.new(self))","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/common/interactions/pointer_input.rb#L29-L65","documentation":"Raised as TypeError by PointerInput#assert_kind when the kind passed to PointerInput.new(kind, name:) is not a key in KIND. KIND permits exactly :mouse, :pen, :touch (each maps to itself as the wire pointerType). The check happens in the constructor, so the error fires at device creation, not at action perform time.","triggerScenarios":"Constructing PointerInput.new(:stylus), PointerInput.new('mouse') (String instead of Symbol), PointerInput.new(:finger), or any value outside {mouse, pen, touch}.","commonSituations":"Appium/W3C examples that use 'finger'/'stylus' (not supported here); passing a String constant; building a custom PointerInput for a touch test on desktop where only :mouse makes sense.","solutions":["Use one of the three Symbols: :mouse, :pen, or :touch.","If you hold the kind in a variable, symbolize and validate: kind = kind.to_sym and check PointerInput::KIND.key?(kind) before constructing."],"exampleFix":"# before\npointer = Selenium::WebDriver::Interactions::PointerInput.new(:finger) # => TypeError\n\n# after\npointer = Selenium::WebDriver::Interactions::PointerInput.new(:touch)","handlingStrategy":"validation","validationCode":"KIND = Selenium::WebDriver::Interactions::PointerInput::KIND\nkind = kind.to_sym\nraise \"unsupported pointer kind: #{kind}\" unless KIND.key?(kind)\n\npointer = Selenium::WebDriver::Interactions::PointerInput.new(kind)","typeGuard":"def valid_pointer_kind?(k)\n  Selenium::WebDriver::Interactions::PointerInput::KIND.key?(k.is_a?(Symbol) ? k : k.to_sym)\nend","tryCatchPattern":null,"preventionTips":["Use only :mouse, :pen, :touch.","Symbolize external kind values and validate against PointerInput::KIND before constructing the device."],"tags":["interactions","pointer-input","typecheck","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}