Rayrun
← Back to Discord Forum

goto() resolves too early

Trace: https://trace.playwright.dev/?trace=https://playwright-tests.contra.dev/621a38b7-d866-403b-b30a-17347a3d9ab0.zip Loom: https://www.loom.com/share/ad160664bf054d4eb437a21e237979cf

As I uncovered during Loom, the goto() resolves too early, resulting in other selectors timing out. I am assuming this is something wrong with how we execute navigation on our website?

This thread is trying to answer question "Is there a way to override the default wait mechanism from `load` to looking for something in the DOM in Playwright?"

7 replies

Hm. Reading the documentation, it appears like this is by design, i.e. Playwright does not make assumptions by default when content has loaded. This is problematic if page takes longer to load. I guess the question is then if there is a way to override the default wait mechanism from load to looking for something in the DOM that we could inject after the loader is not there.

https://playwright.dev/docs/api/class-page#page-goto try to use await page.goto(“url”, { waitIntill: “load”});

That's the default, isn't?

Try another state

Trying random things is probably not the solution.

Or, try also await page.waitForResponse(“someUrlRegex”); https://playwright.dev/docs/api/class-page#page-wait-for-response

Looks like we need to extend goto to add default wait logic, similar to what you've suggested.

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 luc@ray.run.