Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] waitForNavigation does not work on headless despite it working in non-headless #6358

Closed
djasnowski opened this issue Apr 29, 2021 · 2 comments

Comments

@djasnowski
Copy link

Context:

  • Playwright Version: 1.10.0
  • Operating System: Linux OpenSUSE Leap 15.2
  • Node.js version: 14.16.0
  • Browser: Chromium

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:

  test('can we export it to PDF?', async () => {
    const [popup] = await Promise.all([page?.waitForEvent('popup'), page.click('button:has-text("Export as PDF")')]);

    await popup.waitForNavigation({
      waitUntil: 'networkidle',
      timeout: 5000,
    });

    expect(await popup.url().startsWith('blob')).toBeTruthy();
  });

Describe the bug

Basically, this script clicks a button which opens a new tab with a blob:https://URL_EXAMPLE_OF_PDF of a PDF. When it's in non-headless mode, you can see it and it works. Tests pass. When it's in headless mode, the test fails like so:

    TimeoutError: page.waitForNavigation: Timeout 5000ms exceeded.
    =========================== logs ===========================
    waiting for navigation until "networkidle"
    ============================================================
    Note: use DEBUG=pw:api environment variable to capture Playwright logs.

      at node_modules/playwright/lib/client/waiter.js:49:51
      at Waiter.waitForPromise (node_modules/playwright/lib/client/waiter.js:57:28)
      at node_modules/playwright/lib/client/frame.js:120:36
      at Frame._wrapApiCall (node_modules/playwright/lib/client/channelOwner.js:77:28)
@mxschmitt
Copy link
Member

Seems to be an duplicate of #6342 from my understanding. That the PDF won't lead to a PDF viewer on headless and trigger a download event instead.

@mxschmitt
Copy link
Member

Closing for now as part of the triage. If the problem is still persistent, feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants