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
onWaitTimeoutis:Which is sadly not correctly documented. The
detailsobject that is passed into the function contains aselectorproperty that represents the selector. If it is an XPath selector, then you will need to get thepathproperty 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.