page.waitForTimeout() in pyppeteer?

1.5k Views Asked by At

I have a pyppeteer (not puppeteer) browser with many pages opened, and I'd like to wait for example 2 second before doing other stuff on some of these pages. I tried to use time.sleep() but it looks like it blocks the execution of all pages.

Is there an equivalent to page.waitForTimeout() in pyppeteer ? I think I could also use multithreading but I'd like not to.

2

There are 2 best solutions below

0
On

Nevermind,

page.waitFor(2000)

does exactly what I want.

0
On

The equivalent of time.sleep in asynchronous is asyncio.sleep. So use:

await asyncio.sleep(2)  # 2 second non-blocking sleep