Skip to content

[🐛 Bug]: WebDriver actions fail due to conflicting input source ids (Expected input source "action1" to be type key, got pointer) #14740

@lacell75

Description

@lacell75

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

20

Mode

WDIO Testrunner

Which capabilities are you using?

    {
      browserName: 'firefox',
      acceptInsecureCerts: true
    },

What happened?

When running tests that rely on the W3C WebDriver performActions API, WebdriverIO generates action sources with incrementing ids (action1, action2, …). This leads to invalid argument errors when multiple action types (keyboard, pointer, wheel) are used in the same session.

According to the W3C WebDriver spec, each input source id must:

Remain unique for the duration of the session

Always map to the same action type (key, pointer, wheel)

Currently, BaseAction in packages/webdriverio/src/utils/actions/base.ts generates ids like action1, action2, etc. This means the same id can be assigned first to a key input source and later reused for a pointer input source, which causes WebDriver servers (Chromedriver, Geckodriver, etc.) to reject the action request.

What is your expected behavior?

No response

How to reproduce the bug.

Clone this repo https://github.com/lacell75/action-error

Install dependencies then launch wdio:

yarn
npx wdio

Relevant log output

Error logs:

[0-0] 2025-09-02T10:18:04.071Z ERROR webdriver: WebDriverError: Expected input source [object String] "action1" to be type key, got pointer when running "actions" with method "POST" and args "{"actions":[{"id":"action1","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"type":"pointerMove","button":0,"x":0,"y":0,"duration":100,"origin":{"element-6066-11e4-a52e-4f735466cecf":"908aab8a-760a-4cdf-bb83-af0f697be90d"}}]}]}"
[0-0] 2025-09-02T10:18:05.661Z ERROR webdriver: WebDriverError: Expected input source [object String] "action2" to be type key, got wheel when running "actions" with method "POST" and args "{"actions":[{"id":"action2","type":"wheel","parameters":{},"actions":[{"type":"scroll","x":-597,"y":-474,"deltaX":0,"deltaY":0,"duration":0,"origin":{"element-6066-11e4-a52e-4f735466cecf":"908aab8a-760a-4cdf-bb83-af0f697be90d"}}]}]}"
[0-0] 2025-09-02T10:18:07.217Z ERROR webdriver: WebDriverError: Expected input source [object String] "action3" to be type key, got pointer when running "actions" with method "POST" and args "{"actions":[{"id":"action3","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"type":"pointerMove","button":0,"x":0,"y":0,"duration":100,"origin":{"element-6066-11e4-a52e-4f735466cecf":"908aab8a-760a-4cdf-bb83-af0f697be90d"}}]}]}"
[0-0] Error in "MoveTo.MoveTo"
An unknown error occurred

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions