Skip to content

fix(webdriverio): handle 'no such frame' error in BiDi navigation#15018

Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom
mccmrunal:fix/issue-14382-bidi-nav-main
Jan 17, 2026
Merged

fix(webdriverio): handle 'no such frame' error in BiDi navigation#15018
christian-bromann merged 1 commit intowebdriverio:mainfrom
mccmrunal:fix/issue-14382-bidi-nav-main

Conversation

@mccmrunal
Copy link
Contributor

Proposed changes

This is my analysis :-
In WebDriver BiDi mode, the browser.url() command performs a two-step operation: it first resolves the current browsing context ID (via getCurrentContext()) and then issues the browsingContext.navigate command. A race condition occurs if the target browsing context is destroyed (e.g., via window.close() or concurrent navigation) during the latency between ID resolution and command execution. This results in the protocol error: no such frame
In short: You are trying to navigate a "ghost" window.
This is why the error is random: it only happens if the window closes exactly in that tiny gap between checking the ID and using it. My fix handles this by catching that specific "ghost" error and automatically falling back to the "navigate current window" method, which is safer in these situations.

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

//: # (The current main branch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against the v8 branch.)

  • This change is solely for v9 and doesn't need to be back-ported
  • Back-ported PR at #XXXXX

Further comments

Reviewers: @webdriverio/project-committers

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 16, 2026

Open in StackBlitz

create-wdio

npm i https://pkg.pr.new/webdriverio/webdriverio/create-wdio@15018

eslint-plugin-wdio

npm i https://pkg.pr.new/webdriverio/webdriverio/eslint-plugin-wdio@15018

@wdio/allure-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/allure-reporter@15018

@wdio/appium-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/appium-service@15018

@wdio/browser-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browser-runner@15018

@wdio/browserstack-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browserstack-service@15018

@wdio/cli

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cli@15018

@wdio/concise-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/concise-reporter@15018

@wdio/config

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/config@15018

@wdio/cucumber-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cucumber-framework@15018

@wdio/dot-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/dot-reporter@15018

@wdio/firefox-profile-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/firefox-profile-service@15018

@wdio/globals

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/globals@15018

@wdio/jasmine-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/jasmine-framework@15018

@wdio/json-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/json-reporter@15018

@wdio/junit-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/junit-reporter@15018

@wdio/lighthouse-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/lighthouse-service@15018

@wdio/local-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/local-runner@15018

@wdio/logger

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/logger@15018

@wdio/mocha-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/mocha-framework@15018

@wdio/protocols

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/protocols@15018

@wdio/repl

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/repl@15018

@wdio/reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/reporter@15018

@wdio/runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/runner@15018

@wdio/sauce-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sauce-service@15018

@wdio/shared-store-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/shared-store-service@15018

@wdio/smoke-test-cjs-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-cjs-service@15018

@wdio/smoke-test-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-reporter@15018

@wdio/smoke-test-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-service@15018

@wdio/spec-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/spec-reporter@15018

@wdio/static-server-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/static-server-service@15018

@wdio/sumologic-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sumologic-reporter@15018

@wdio/testingbot-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/testingbot-service@15018

@wdio/types

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/types@15018

@wdio/utils

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/utils@15018

@wdio/webdriver-mock-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/webdriver-mock-service@15018

@wdio/xvfb

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/xvfb@15018

webdriver

npm i https://pkg.pr.new/webdriverio/webdriverio/webdriver@15018

webdriverio

npm i https://pkg.pr.new/webdriverio/webdriverio@15018

commit: e008a50

@mccmrunal mccmrunal closed this Jan 16, 2026
@mccmrunal mccmrunal reopened this Jan 16, 2026
@mccmrunal mccmrunal force-pushed the fix/issue-14382-bidi-nav-main branch from 73690d9 to e008a50 Compare January 16, 2026 17:15
@mccmrunal mccmrunal closed this Jan 16, 2026
@mccmrunal mccmrunal reopened this Jan 16, 2026
@christian-bromann christian-bromann added the PR: Bug Fix 🐛 PRs that contain bug fixes label Jan 17, 2026
@christian-bromann christian-bromann merged commit d84de53 into webdriverio:main Jan 17, 2026
96 of 97 checks passed
@wdio-bot
Copy link
Contributor

Hey mccmrunal 👋

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution.

We've sent you an email with further instructions on how to claim your expenses from our development fund.
Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at expense@webdriver.io or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future 🙌

Have a nice day,
The WebdriverIO Team 🤖

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

Labels

Expensable $15 💸 PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants