0
Я не понимаю, как поймать ошибку на CasperJsCasperJs поймать ошибка
У меня есть этот код
casper.thenClick('#activeCartViewForm > a');
И вернуть мне иногда:
[error] [remote] mouseEvent(): Couldn't find any element matching '#activeCartViewForm > a' selector
Я хотел бы, чтобы поймать это и this.die(errorMsg)
, чтобы остановить мой casperjs.
Я пытаюсь добавить waitForSelector
:
casper.waitForSelector('#activeCartViewForm > a', function() {
this.click('#activeCartViewForm > a');
});
Но уже с той же проблемой.
И когда я сделал:
casper.on('step.error', function(err) {
this.die("Step has failed: " + err);
});
Ничто не бывает
и когда я сделал:
casper.on('resource.error', function(err) {
console.log(err);
this.die("Step has failed: " + err.errorString);
});
Это финансирующего меня ошибка никогда не видела раньше, и остановить мой phantomjs:
[error] [phantom] Error: the remote server closed the connection prematurely
[error] [phantom] Error: The request has been aborted
[error] [phantom] Error: The request has been aborted
[error] [phantom] Error: the remote server closed the connection prematurely
Thanks