I want to open webpage1 do some tests and later open webpage2
casper.start('http://localhost/awesome_page1', initialize);
casper.then(function () {
casper.test.assertHttpStatus(200);
});
// tasks completed in first webpage
casper.start('http://localhost/awesome_page2', initialize);
casper.then(function () {
casper.test.assertHttpStatus(200);
});
casper.run(function () {
casper.test.done();
});
When I am executing the code only the second webpage2 is opening. How to solve this?
Seems like the answer is right there on the Casper's main page - use thenOpen
:
var casper = require('casper').create();
casper.start('http://casperjs.org/');
casper.then(function() {
this.echo('First Page: ' + this.getTitle());
});
casper.thenOpen('http://phantomjs.org', function() {
this.echo('Second Page: ' + this.getTitle());
});
casper.run();