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

Replace waitForTimeout #834

Merged
merged 2 commits into from
Apr 1, 2024
Merged

Conversation

niclas-timm
Copy link
Contributor

Problem

The page.waitForTimeout method in Puppeteer was removed in v22. Therefore, using the setDelay method on a Browsershot instance will result in the following error:

TypeError: page.waitForTimeout is not a function
    at callChrome (.../vendor/spatie/browsershot/bin/browser.cjs:331:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Solution

As recommended in the documentation for older versions of Puppeteer, replace page.waitForTimeout in browser.cjs with await new Promise(r => setTimeout(r, request.options.delay)).

@niclas-timm niclas-timm changed the title Remove wait for timeout Replace waitForTimeout Mar 28, 2024
@potsky potsky mentioned this pull request Mar 30, 2024
@potsky
Copy link

potsky commented Mar 30, 2024

It works @freekmurze 👍

@freekmurze freekmurze merged commit b764ca1 into spatie:main Apr 1, 2024
1 of 5 checks passed
@freekmurze
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants