From df632877c7fe2ab9eddb2cbdd3dcc5edee80684e Mon Sep 17 00:00:00 2001 From: shadowusr Date: Sun, 3 May 2026 02:17:54 +0300 Subject: [PATCH] fix: add an option to disable auto-retrying of cancelled request --- .../webdriverio/src/commands/browser/url.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/webdriverio/src/commands/browser/url.ts b/packages/webdriverio/src/commands/browser/url.ts index 459e7eeeabd..95919f3e026 100644 --- a/packages/webdriverio/src/commands/browser/url.ts +++ b/packages/webdriverio/src/commands/browser/url.ts @@ -216,6 +216,10 @@ export async function url ( url: path, wait }).catch((err) => { + if (options._noFallbackOnCancel) { + throw err + } + /** * It seems that WebDriver Bidi runs into issue with concurrent navigation. * @see https://github.com/w3c/webdriver-bidi/issues/878 @@ -326,4 +330,18 @@ interface UrlCommandOptions { * Checkout `browser.addPreloadScript` for a more versatile way to mock the environment. */ onBeforeLoad?: () => unknown + /** + * @internal + * + * UNSTABLE / INTERNAL — not part of the public API. May be renamed or removed at any time + * without notice and without a major version bump. Do not rely on this in user code. + * + * Used internally to disable the automatic fallback that re-issues the navigation when the + * driver reports a concurrent-navigation error (Chrome: "navigation canceled by concurrent + * navigation", Firefox: "failed with error: unknown error"). Intended for callers that + * intentionally cancelled the navigation and want the original error to propagate. + * + * @default false + */ + _noFallbackOnCancel?: boolean }