varjoll
varjoll

Reputation: 29

page.waitForTimeout() in pyppeteer?

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.

Upvotes: 0

Views: 1802

Answers (2)

Faizan AlHassan
Faizan AlHassan

Reputation: 429

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

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

Upvotes: 0

varjoll
varjoll

Reputation: 29

Nevermind,

page.waitFor(2000)

does exactly what I want.

Upvotes: 2

Related Questions