javascript - this.echo is not working in this.thenOpen -



javascript - this.echo is not working in this.thenOpen -

i wrote simple capserjs script based on casperjs - how open links in array of links , not print title.

var casper = require('casper').create(); var = -1; var links; casper.start('http://www.waspbarcode.com/barcode-scanners', function() { links = ['https://www.yahoo.com' , 'https://www.google.com' , 'http://stackoverflow.com'] }); casper.then(function() { this.each(links, function() { i++; this.thenopen(links[i], function() { this.echo(this.gettitle()); }); }); this.exit(); }); casper.run();

because did this.exit(); after trying open urls in links.

you need understand works asynchronously. programs exits after casperjs starts loading links 1 after other.

javascript web-scraping casperjs

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -