I'd like to use the waitForUrl() function from http://ift.tt/2ernexx . After a login form was send casperjs should wait for the next page is loaded. In the code below you see the "Second variant" that's the way I try to code this and you also see the occuring error message. The "First variant" is working so the dashboard.png is captured.
Can someone explain what is wrong with the "First variant"?
// ...
// Type and send login Form
casper.then(function() {
this.evaluate(function(){
$("username").value="admin";
$("password").value="pass#";
$("login").click();
});
});
// First variant (works) -----------------
// casper.then(function() {
// this.clickLabel('Dashboard', 'a');
// });
// Second variant (works not, error) -----------------
// casper.waitForUrl(/\/admin\/index\.php/,function() {
// this.clickLabel('Dashboard', 'a');
//});
// -> [error] [phantom] Wait timeout of 5000ms expired, exiting.
// -> Wait timeout of 5000ms expired, exiting.
casper.then( function(){
this.capture('./dashboard.png');
});
Aucun commentaire:
Enregistrer un commentaire