From db2bff1f779642bd6264404d16826cca11ee4490 Mon Sep 17 00:00:00 2001 From: Denys Kuchma Date: Tue, 13 Jan 2026 19:05:42 +0200 Subject: [PATCH] include actual error in waitUrlEquals when URL matches --- lib/helper/Playwright.js | 6 +++++- lib/helper/Puppeteer.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index 5ab67f98e..8b18f34a0 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -3557,7 +3557,11 @@ class Playwright extends Helper { .catch(async e => { const currUrl = await this._getPageUrl() // Required because the waitForFunction can't return data. if (/Timeout/i.test(e.message)) { - throw new Error(`expected url to be ${urlPart}, but found ${currUrl}`) + if (urlPart !== currUrl) { + throw new Error(`expected url to be ${urlPart}, but found ${currUrl}`) + } else { + throw new Error(`expected url not loaded, error message: ${e.message}`) + } } else { throw e } diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index 6ed5f1857..39bfb6183 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -2467,7 +2467,11 @@ class Puppeteer extends Helper { .catch(async e => { const currUrl = await this._getPageUrl() // Required because the waitForFunction can't return data. if (/Waiting failed/i.test(e.message) || /failed: timeout/i.test(e.message)) { - throw new Error(`expected url to be ${urlPart}, but found ${currUrl}`) + if (urlPart !== currUrl) { + throw new Error(`expected url to be ${urlPart}, but found ${currUrl}`) + } else { + throw new Error(`expected url not loaded, error message: ${e.message}`) + } } else { throw e }