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.

Implement setDefaultWaitTimeout or setDefaultTimeouts

See original GitHub issue

Right now we have page.setDefaultNavigationTimeout(timeout) which is very useful. If we want to take things forward, we can implement the following,

setDefaultWaitTimeout(timeout)

This will help set a default timeout for waitFor function or similar to those. There are obviously more waitFor use cases than goto.

setDefaultTimeouts({ navigation: timeout, waitFor: timeout })

Same like above, this will let one update all timeouts at once or just the one they want. Will remove the need for setDefaultNavigationTimeout or setDefaultWaitTimeout if happens and window for more useful api

PS: I have a project where I have at least thousands of waitFor cases for some reason and hundreds of navigation calls, this feels really promising in that sense where people have lots of test cases.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
aslushnikovcommented, Nov 16, 2018

We’ve discussed this with @JoelEinbinder and really liked the following approach.

  1. For now, let’s keep it simple and introduce a single page.setDefaultTimeout(number) method. This overrides all timeouts we use for navigations and waitFor* methods.
page.setDefaultNavigationTimeout(10000);
// Set all timeouts everywhere for 5 seconds.
// However, the navigation will still default to 10 seconds.
page.setDefaultTimeout(5000);
  1. If the need emerges, we can always be fancy and teach page.setDefaultTimeout to accept an object with a set of per-method configuration methods:
page.setDefaultTimeout({
  navigation: 10000, // equal to page.setDefaultNavigationTimeout(1000),
  waitForSelector: 12000, // set default timeout for page.waitForSelector
});

Let me know what you think.

0reactions
batpurevcommented, Jul 2, 2021

Hi Gurus,

Have this been implemented? I tried to use this setting but getting this error message. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

puppeteer 1.12.0 on Node.js Yarn
New page.setDefaultTimeout(timeout) allows controlling default timeout for all page operations. Puppeteer now ships a .d.ts file for better TypeScript support.
Read more >
puppeteer-core: Versions
evaluate freezes / hangs on detached frames. #3319 - Implement setDefaultWaitTimeout or setDefaultTimeouts; #3327 - Puppeteer page.select got error: Cannot read ...
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