I have many casper.waitForSelector
parts in my script. Anyway I would like to know whenever it times out. Therefore I added:
casper.options.onWaitTimeout = function() {
//how to echo Selector which timed out here
};
Furthermore I would like to echo the selector which timed out.
The signature of
onWaitTimeout
is:Which is sadly not correctly documented. The
details
object that is passed into the function contains aselector
property that represents the selector. If it is an XPath selector, then you will need to get thepath
property of that.Please note that this function will catch all wait timeouts and you will have to exit the script yourself if you so choose.
It's always a good idea to look at the source code: 1 & 2.