question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Page.goto() flakiness - seeing TimeoutError sometimes

See original GitHub issue

Context:

  • Playwright Version: v1.2.1
  • Operating System: Docker on Linux
  • Node version: v12.18.2
  • Browser: Chromium

Describe the bug

Hey team. I hope all is well. I’m seeing occasional timeouts during page.goto(). I haven’t found a way to repro this constistently - it only happens about ~5%~ 20% of the time. The strange thing is that in these cases, the navigation actually did succeed. I can tell by looking at screenshots and videos. It’s just that Playwright doesn’t recognize the load event.

TimeoutError: Timeout 30000ms exceeded during page.goto.
====================== page.goto logs ======================
[api] navigating to "https://portfolio.adobe.com", waiting until "load"
[api] navigated to "https://portfolio.adobe.com/"
[api] "domcontentloaded" event fired
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.

  147 |   // we have an environment to insert the session into
  148 |   if (page.url().indexOf(CONFIG.baseUrl) === -1) {
> 149 |     await page.goto(CONFIG.baseUrl);
      |                ^
  150 |     await page.waitForSelector(Home.CTAHeader);
  151 |   }
  152 | }

  at ProgressController.run (node_modules/playwright-chromium/lib/progress.js:73:30)
  at runNavigationTask (node_modules/playwright-chromium/lib/frames.js:961:23)
  at Frame.goto (node_modules/playwright-chromium/lib/frames.js:284:16)
  at Frame.goto (node_modules/playwright-chromium/lib/helper.js:79:31)
  at node_modules/playwright-chromium/lib/page.js:203:61
  at Page._attributeToPage (node_modules/playwright-chromium/lib/page.js:356:20)
  at Page.goto (node_modules/playwright-chromium/lib/page.js:203:21)
  at Page.apply (node_modules/playwright-chromium/lib/helper.js:79:31)
    -- ASYNC --
  at Frame.goto (node_modules/playwright-chromium/lib/helper.js:78:23)
  at node_modules/playwright-chromium/lib/page.js:203:61
  at Page._attributeToPage (node_modules/playwright-chromium/lib/page.js:356:20)
  at Page.goto (node_modules/playwright-chromium/lib/page.js:203:21)
  at Page.apply (node_modules/playwright-chromium/lib/helper.js:79:31)
  at _maybeGoToHomepage (helpers/authHelper.ts:149:16)
  at command (helpers/authHelper.ts:206:24)
    -- ASYNC --
  at Page.apply (node_modules/playwright-chromium/lib/helper.js:78:23)
  at _maybeGoToHomepage (helpers/authHelper.ts:149:16)
  at command (helpers/authHelper.ts:206:24)
  at signupAndLogin (helpers/authHelper.ts:210:10)
  at Object.<anonymous> (specs/features/onboarding.critical.ts:26:11)

Have you seen this at all before? Do you have any idea what could be causing this or how I could repro this issue consistently? As a potential workaround, is there any way to change the default event to domcontentloaded for all page.goto() calls?

Thank you for taking a look.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
dgozmancommented, Jul 31, 2020

The best way would be to run with DEBUG=pw:protocol and send the log to us. Note that it contains a lot of information like cookies, so make sure you are comfortable sharing that.

Otherwise, perhaps logging all requests would help. Try adding the following and sharing the output.

page.on('request', r => console.log('request', r.url()));
page.on('requestfailed', r => console.log('requestfailed', r.url()));
page.on('requestfinished', r => console.log('requestfinished', r.url()));
1reaction
dgozmancommented, Jul 30, 2020

Sorry, it was just a part of our test. Here is something I’d try:

async function loop(reusePage) {
  let page = await browser.newPage();
  while (true) {
    if (!reusePage) {
      await page.close();
      page = await browser.newPage();
    }
    await page.goto('....');
  }
}

// 20 loops in parallel
for (let i = 0; i < 20; i++)
  loop(i < 10);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does puppeteer page.goto() throw a timeout error?
Removing waitUntil: "networkidle0" works so I'm assuming the site is still holding a connection to the server.
Read more >
Playwright - Quality Thoughts
I noticed in the example above there can be a race condition between Playwright clicking and waiting for the response, resulting in the...
Read more >
Playwright/CHANGELOG and Playwright Releases (Page 3)
#3151 - [BUG] Page.goto() flakiness - seeing TimeoutError sometimes #3192 - [Question] Check if element is stable #3215 - [Feature] Roll Firefox to...
Read more >
Debug BrowserStack Automate idle timeout error
If another command does not arrive at BrowserStack within the default timeout duration of 90 seconds, the session generates the BROWSERSTACK_IDLE_TIMEOUT error ......
Read more >
Page | Playwright - CukeTest
Also emitted if the page throws an error or a warning. The arguments passed into console.log appear as arguments on the event handler....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found