Rayrun
← Back to Discord Forum

[BUG] toHaveURL validation not working in headless mode

thiagofragoso_posted in #help-playwright
Open in Discord
thiagofragoso_

Hi all, This test works in headed mode, but do not work in headless mode. Never.

Any tips?

await page.getByText('Imprimir').click()

const pagePromise = context.waitForEvent('page'); await page.getByRole('link', { name: 'Guia de Reparação' }).click();

const newPage = await pagePromise; await newPage.waitForLoadState(); await expect(newPage).toHaveURL(/guia/,url);

Error:

Error: page.waitForLoadState: Test timeout of 200000ms exceeded. at tests\MM\CriarGuiaMM.spec.js:21:17

Execution log

"networkidle" event fired

This thread is trying to answer question "Why does the toHaveURL validation test work in headed mode but not in headless mode, and how can this issue be resolved?"

4 replies

Hi, have you tried recording a trace and viewing it with the trace viewer? https://playwright.dev/docs/trace-viewer-intro

thiagofragoso_

Yes I did. I used all the tools in order to find it but no joy. It simply doesn’t load the new page.

thiagofragoso_

Btw, on the trace was everything as expected, clicking on the right locators.

Then the only thing I can suggest is to create an issue for this at GitHub.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].