{"record":{"id":"08fa83993f7a6cba","repo":"SeleniumHQ/selenium","slug":"invalid-pointerinput-kind-kind","errorCode":null,"errorMessage":"Invalid PointerInput kind '{kind}'","messagePattern":"Invalid PointerInput kind '(.+?)'","errorType":"validation","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/common/actions/pointer_input.py","lineNumber":32,"sourceCode":"# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\nfrom typing import Any\n\nfrom selenium.common.exceptions import InvalidArgumentException\nfrom selenium.webdriver.common.actions.input_device import InputDevice\nfrom selenium.webdriver.common.actions.interaction import POINTER, POINTER_KINDS\nfrom selenium.webdriver.remote.webelement import WebElement\n\n\nclass PointerInput(InputDevice):\n    DEFAULT_MOVE_DURATION = 250\n\n    def __init__(self, kind, name):\n        super().__init__()\n        if kind not in POINTER_KINDS:\n            raise InvalidArgumentException(f\"Invalid PointerInput kind '{kind}'\")\n        self.type = POINTER\n        self.kind = kind\n        self.name = name\n\n    def create_pointer_move(\n        self,\n        duration=DEFAULT_MOVE_DURATION,\n        x: float = 0,\n        y: float = 0,\n        origin: WebElement | None = None,\n        **kwargs,\n    ):\n        action = {\"type\": \"pointerMove\", \"duration\": duration, \"x\": x, \"y\": y, **kwargs}\n        if isinstance(origin, WebElement):\n            action[\"origin\"] = {\"element-6066-11e4-a52e-4f735466cecf\": origin.id}\n        elif origin is not None:\n            action[\"origin\"] = origin\n        self.add_action(self._convert_keys(action))","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/common/actions/pointer_input.py#L14-L50","documentation":"`PointerInput.__init__` validates that `kind` is one of the allowed pointer kinds (`POINTER_KINDS = {\"mouse\", \"touch\", \"pen\"}`). Any other value raises `InvalidArgumentException`. The pointer type is sent verbatim to the W3C actions endpoint, so an invalid kind would be rejected by the driver anyway; Selenium rejects it early.","triggerScenarios":"`PointerInput(\"keyboard\", \"name\")`, `PointerInput(\"MOUSE\", \"name\")` (case sensitivity), `PointerInput(\"stylus\", \"name\")`, or `PointerInput(\"\", \"name\")`. The valid set is exactly {mouse, touch, pen}.","commonSituations":"Using uppercase by mistake. Trying to use \"stylus\"/\"pen-tablet\" (use \"pen\"). Custom action-builder code that constructs PointerInput directly. Version drift where a kind was renamed.","solutions":["Use a valid kind from selenium.webdriver.common.actions.interaction: POINTER_MOUSE/POINTER_TOUCH/POINTER_PEN (\"mouse\", \"touch\", \"pen\").","Reference the constants instead of hardcoding: `from selenium.webdriver.common.actions.interaction import POINTER_PEN; PointerInput(POINTER_PEN, \"pen\")`.","For a stylus, use \"pen\"."],"exampleFix":"// before\nPointerInput(\"MOUSE\", \"mouse1\")  # InvalidArgumentException - case\n// after\nfrom selenium.webdriver.common.actions.interaction import POINTER_MOUSE\nPointerInput(POINTER_MOUSE, \"mouse1\")","handlingStrategy":"validation","validationCode":"from selenium.webdriver.common.actions.interaction import POINTER_KINDS\nkind = \"mouse\"\nassert kind in POINTER_KINDS, f\"kind must be one of {POINTER_KINDS}\"\nPointerInput(kind, \"mouse1\")","typeGuard":"from selenium.webdriver.common.actions.interaction import POINTER_KINDS\ndef is_valid_pointer_kind(kind: str) -> bool:\n    return kind in POINTER_KINDS","tryCatchPattern":"from selenium.common.exceptions import InvalidArgumentException\ntry:\n    pi = PointerInput(kind, name)\nexcept InvalidArgumentException:\n    pi = PointerInput(\"mouse\", name)  # default to mouse","preventionTips":["Reference POINTER_MOUSE/POINTER_TOUCH/POINTER_PEN constants, not literals.","Remember the valid set is exactly {mouse, touch, pen} (lowercase).","Use \"pen\" for stylus input."],"tags":["pointer-input","actions","invalid-argument","w3c"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}