Reputation: 24588
I would like to call casper.start()
multiple times in my script.
I have tried:
var ids = [1,6,13];
ids.forEach(function(id) {
casper.start('http://localhost/mypage?id='+id, function() { });
});
casper.then(function() {
....
However, only the last id gets executed.
It is possible to call casper.start()
multiple times? If so, how?
Upvotes: 2
Views: 664
Reputation: 61892
start()
should only be called once for one casper
object. You see only one call, because a second call to start()
resets the internal state. You can use thenOpen()
to open multiple pages:
var ids = [1,6,13];
casper.start();
ids.forEach(function(id) {
casper.thenOpen('http://localhost/mypage?id='+id, function() {
this.capture("id.png");
});
});
casper.run();
Upvotes: 4