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

226 Views Asked by At

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.

1

There are 1 best solutions below

0
Orelsanpls On BEST ANSWER

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.