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 }