puppeteer/puppeteer

Setting timeout: 0 in waitForFunction does not remove default timeout condition

Closed this issue · 1 comments

What steps will reproduce the problem?

Please include code that reproduces the issue.

await page.waitForFunction(
    () => document.querySelector('.loading-item').getAttribute('something') === 'takes a long time',
    { timeout: 0 })

What is the expected result?

That waitForFunction will continue waiting without limit

What happens instead?

I get the following error:

Error: waiting failed: timeout 30000ms exceeded at Timeout.WaitTask._timeoutTimer.setTimeout

Thoughts

Maybe this is by design? Perhaps it is bad practice to query the page without a timeout in place, but my use case is file uploads, wherein I have no idea the network speed, so I cannot calculate a reasonable timeout.

Moreover, page.waitForNavigation has a timeout override.

Any other thoughts here?

This has been fixed in #1964. Will be available in the next release.