Skip to content

Webdrivers's click should be called with undefined as the default value #8931

@julienw

Description

@julienw

Describe the bug

I noticed that actionClick is used instead of elementClick in webdriver (context: https://github.com/webdriverio/webdriverio/blob/e86efccd84e20b01713a43113d166d8deb397edc/packages/webdriverio/src/commands/element/click.ts#L109-L121), even when passing no option.

The problem is that an empty object is passed by default in:

export const click: UserEventCommand<UserEvent['click']> = async (
context,
selector,
options = {},
) => {
const browser = context.browser
await browser.$(selector).click(options as any)
}

I noticed that because actionClick was giving me other errors later (probably a webdriverio or browser issue, I'll deal with that too).

Reproduction

I don't think that's needed

System Info

System:
    OS: Linux 6.7 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900H @ 2.50GHz
    Memory: 30.91 GB / 62.54 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 24.8.0 - /home/julien/.nvm/versions/node/v24.8.0/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 11.6.0 - /home/julien/.nvm/versions/node/v24.8.0/bin/npm
    pnpm: 10.9.0 - /home/julien/.local/share/pnpm/pnpm
    bun: 1.0.29 - /home/julien/.bun/bin/bun
    Deno: 2.0.0 - /home/julien/.cargo/bin/deno
    Watchman: 4.9.0 - /usr/bin/watchman
  Browsers:
    Chrome: 141.0.7390.107
    Chromium: 141.0.7390.65
    Firefox: 140.4.0esr
    Firefox Developer Edition: 140.4.0esr
  npmPackages:
    @vitest/browser-webdriverio: ^4.0.4 => 4.0.4 
    @vitest/coverage-istanbul: ^4.0.4 => 4.0.4 
    @vitest/eslint-plugin: ^1.3.26 => 1.3.26 
    vite: ^7.1.12 => 7.1.12 
    vitest: ^4.0.4 => 4.0.4 
    vitest-browser-lit: ^1.0.1 => 1.0.1 
    webdriverio: ^9.20.0 => 9.20.0

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions