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

Wait for navigation (networkidle) even if no new requests are instantiated #945

Closed
BkSouX opened this issue Oct 3, 2017 · 1 comment
Closed

Comments

@BkSouX
Copy link

BkSouX commented Oct 3, 2017

Hi

I am using the code from #913 to set content and wait for navigation.

try {
    await Promise.all([
      page.setContent(html),
      page.waitForNavigation({ waitUntil: 'networkidle' }),
    ]);
  } catch (e) {
    logger.error('Issue setting content');
    throw e;
  }

But sometimes, I don't have any new requests in the HTML so it waits a long time before crashing i suppose.
Any idea how I can handle that ?

Thank you

@aslushnikov
Copy link
Contributor

That's today's limitation of the system, should be addressed with the #728 being fixed.
As a workaround, i'd suggest navigating to data URL:

await page.goto('data:text/html,' + html, {waitUntil: 'networkidle'});

Closing as a dupe of #728.

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