fix(browser-runner): support Node-registered custom element commands by carrerasdarren-cell · Pull Request #16113 · webdriverio/webdriverio · GitHub
Skip to content

fix(browser-runner): support Node-registered custom element commands - #16113

Open
carrerasdarren-cell wants to merge 1 commit into
webdriverio:mainfrom
carrerasdarren-cell:codex/browser-element-commands-12717-20261017
Open

carrerasdarren-cell wants to merge 1 commit into
webdriverio:mainfrom
carrerasdarren-cell:codex/browser-element-commands-12717-20261017

Conversation

@carrerasdarren-cell

Copy link
Copy Markdown
Contributor

Proposed changes

Fixes #12717. A custom element command registered in the Node-side before hook is currently announced to the browser as a name only, so the component spec receives a browser command and element.customCommand() fails with a missing-function error. Carry the existing attachToElement option through the worker event and browser state, then register an element proxy that sends its receiver's element ID to the existing Node handler.

Keep browser and element registrations distinct by scope and name, deduplicate them within each session, and validate the browser-state descriptors centrally. The Node handler already reconstructs the element receiver and is unchanged. Add a standard component lane covering native/browser controls, two element receivers, same-name scope separation, argument/async-result delivery, original error name/message, and rejection of a missing element ID.

How you tested

  • On original 3b5e5df, the isolated Chrome 158 component reproduction passed the browser/native controls and failed the element command with element.ownedElementCommand is not a function. The identical three-check input passed after the fix. Three durable transport/state regressions also failed on the unchanged product before implementation.
  • pnpm run test:package wdio-browser-runner --maxWorkers=2 — 107 passing.
  • pnpm run test:package wdio-utils --maxWorkers=2 — 541 passing.
  • pnpm run test:package wdio-types --maxWorkers=2 — 11 passing, including type fixtures.
  • Source tsc --noEmit for all three touched packages, pnpm run test:typings:webdriverio, normal Oxlint and focused lint of the new component JS files passed.
  • pnpm --dir e2e run test:browser:customCommands — all seven real Chrome 158 tests passed, with the standard lane reporting 100% coverage of the synthetic fixture and its setup. The script is included in the normal component chain.

Component baseline limits: pnpm run test:component exits 1 at the existing Vue empty-array and strict multi-element text assertions (resolved/received undefined). Running the remaining standard scripts separately passes Svelte, Lit, Stencil and the new custom-command lane; misc passes nine tests but retains two image-dimension failures (256x213 versus 600x500, then 256x256 versus 400x400). The same four failures were reproduced earlier on unmodified 3b5e5df with the same Chrome 158 and lockfile. Their fixtures and normal config remain unchanged here. The uncaught-error checker could not reach a test in two current normal attempts because driver startup failed with TLS read ETIMEDOUT; it is not reported as verified in this run. No assertions were weakened or skipped to make the component suite appear green.

  • Unit tests for the touched package(s)
  • Type definition tests
  • Real-browser component proof

Types of changes

  • Polish
  • Bugfix
  • New feature
  • Breaking change
  • Documentation update
  • Specification changes
  • Internal updates

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective
  • I have added the necessary documentation (verification feature entry)
  • I have added the appropriate type definitions and type tests

Backport Request

  • This change targets the current v10 browser channel
  • Back-ported PR at #XXXXX

Further comments

Prepared with OpenAI Codex assistance. Validation used actual local commands and isolated Chrome sessions; no cloud-provider or other-browser matrix was run.

@carrerasdarren-cell
carrerasdarren-cell requested a review from a team as a code owner October 17, 2026 05:48
@wdio-bot wdio-bot added the PR: Bug Fix 🐛 PRs that contain bug fixes label Oct 17, 2026
@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: custom element commands doesn't work with browser runner

2 participants