I'm building a tool that logs into a website and visits a high number of pages that are listed in an array. Everytime I run this CasperJS seems to hang when visiting the 36th link. I tried removing the 36th link, but then it just hangs at the next one.
Could it be a memory problem? When CasperJS hangs in the debug log there is no error. When I run top on the server I'm not seeing any phantomJS processes running anymore.
spooky.then([{user: account.user, pass: account.pass, urls: urls}, function(){
this.wait(2000, function() {
this.fill(".signin-form", {
email: user,
password: pass
}, true);
var i = 0;
var spookyObj = this
function visitPages () {
spookyObj.wait(5000, function(){
spookyObj.thenOpen(urls[i], function(url){
spookyObj.emit('visitedURL', url[i]);
i ++
if (i < urls.length) visitPages();
});
});
}
visitPages();
});
}]);
Debug log
[debug] [phantom] url changed to "<URL>"
[debug] [phantom] Navigation requested: url=about:blank, type=Other, willNavigate=true, isMainFrame=false
[debug] [phantom] Navigation requested: url=<URL>, type=Other, willNavigate=true, isMainFrame=false