phantomjs - Why won't CasperJS accept a redirect request after clicking on a link? -


i'm having more casper troubles, time i've told casper click on href redirect page redirect twitter app auth page:

    var casper = require('casper').create({     verbose: false,     loglevel: 'debug',     waittimeout: 10000 }); phantom.cookiesenabled = true;  casper.start('http://foo.bar', function afterstart() {     if (this.exists('#back-to-top')) {         this.echo('booya! foo.bar loaded', 'info');     } else {         this.echo('page didnt load, went screwy.', 'error');     } });  casper.then(function signin() {     this.click('a[href="/sys/login"]' );  });  casper.then(function tellsignin() {     if (this.exists('#not-logged-in ')) {         this.echo("i clicked on twitter login button, twitter login page loaded.", 'info');     } else {         this.echo('twitter login link didnt work, went wacky');     }; }); 

when run it, console error output this, plus other stuff isn't important:

test file: testingtest.js                                                        booya! foo.bar loaded twitter login link didnt work, went wacky 

i've tried looking explanations, , found this group thread, unfortunately doesn't provide answers problem. know possible reasons why casper isn't redirecting?

i've resolved issue of , support haha. happened tellsignin function being executed before browser had time redirected twitter app auth page, added this.waitfortext('authorize foo-bar app use account?') signin function.


Comments