If you do not need to synchronize behavior between all open URLs, you must run multiple instances of casper for each URL. Here is an example:
var casperActions = { href1: function (casper) { casper.start(address, function() {...}); // tests and what not for href1 casper.run(function() {...}); }, href2: function (casper) { casper.start(address, function() {...}); // tests and what not for href2 casper.run(function() {...}); }, ... }; ['href1', 'href2', ...].each(function(href) { var casper1 = require('casper').create(); casperActions[href](casper); });
Each instance will work independently, but this will allow you to remove multiple URLs at once.
matt snider
source share