-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Implement setDefaultWaitTimeout or setDefaultTimeouts #3319
Comments
I like the |
@aslushnikov #2079 lists What is your thinking on And finally, do you mind if I take a stab at this? |
I'd very much like to see this as well, if @alexbepple is already working on this I will wait, otherwise I might create a PR if I get around to do it. |
@SimonSchick @alexbepple please go ahead and submit a PR! |
I'd rather discuss this a little, do we want more fine grained control over timeouts? Current idea:
where as all property should be optional so you can set individual timeouts without settings all ther others. |
@SimonSchick I am in favor of I am wondering whether anybody has a use case for such a fine-grained timeout control? Personally, I favor simpler solutions. So I would have been happy with an all-encompassing Even with a more differentiating approach, I would like to see an all-encompassing |
@alexbepple, Yes there are fine needs for such.
Sounds really ambiguous, but, either you make another wrapper on top of puppeteer for your specific case, or implement the function directly to avoid overhead. Ie,
I did not have any use case for target, network and such yet, but I think once we have basic version like navigation and waitFor, we can extend it in future, and have more control over the execution. Simplest reason would be |
We've discussed this with @JoelEinbinder and really liked the following approach.
page.setDefaultNavigationTimeout(10000);
// Set all timeouts everywhere for 5 seconds.
// However, the navigation will still default to 10 seconds.
page.setDefaultTimeout(5000);
page.setDefaultTimeout({
navigation: 10000, // equal to page.setDefaultNavigationTimeout(1000),
waitForSelector: 12000, // set default timeout for page.waitForSelector
}); Let me know what you think. |
Method `page.setDefaultTimeout` overrides default 30 seconds timeout for all `page.waitFor*` methods, including navigation and waiting for selectors. Fix puppeteer#3319.
Method `page.setDefaultTimeout` overrides default 30 seconds timeout for all `page.waitFor*` methods, including navigation and waiting for selectors. Fix #3319.
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 morewaitFor
use cases thangoto
.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
orsetDefaultWaitTimeout
if happens and window for more useful apiPS: 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.
The text was updated successfully, but these errors were encountered: