简体   繁体   中英

Set timeout time works not in all cases in Pyppeteer

I set timeout time in Pyppeteer to 60 sec, but it doesn't work for all pages. Here is my code:

options = {'timeout': 60 * 1000}
response = await self.page.goto(url, options)

I try to load this URL with a timeout: http://www.google.com:81 But after 60 sec it doesn't raise timeout exception. After 4 minutes it raises net::ERR_TIMED_OUT How can I set timeout time for pages as I have?

In Python, duration is calculated using seconds, not microseconds. That is why you have to:


options = {'timeout': 60}
response = await self.page.goto(url, options)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM