简体   繁体   中英

How to skip step when the timeout is reached on wait function

How can I prevent the script from stop beign executed when it hits the timeout limit? My code looks like:

this.waitForSelector("#my_selector", function(){
     //...  magic code
} , null, 30000)

After reaching 30000 miliseconds it stops but there is more things to be scraped after this iteration.

The point of a timeout is to handle an non-nominal behavior (cannot connect or else...) .

Your function should stop. If in your case if it shouldn't, it means that your timeout is not set accordingly to your use case, you surely needs to increase it.

The waitWhileSelector() function can take a callback in case of timeout, which would be your error handling.

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