javascript - Why can't my CasperJS script login to Quora? -
this code:
var casper = require('casper').create({ verbose: true, loglevel: 'debug' }); casper.start('http://www.quora.com', function() { this.click('input.submit_button'); this.echo("page loaded"); this.test.assertexists('form.inline_login_form', 'form found'); this.fill('form.inline_login_form',{email:'xxxxxx@gmail.com',password:'xxxx'},false); } ); casper.then(function(){ this.click('input.submit_button'); }); casper.then(function(){ this.capture('google.png', { top: 0, left: 0, width:0, height:0 }); this.echo("page title " + this.gettitle()); }); casper.run();
this image capture method produces:
why doesn't login? id , password correct.
try this, must work :
var casper = require('casper').create({ viewportsize: { width: 1080, height: 768 } }); var email = "xxx@abc.com"; var pass = "********"; casper.start('http://www.quora.com', function() { this.click('input.submit_button'); this.echo("page loaded"); this.test.assertexists('form.inline_login_form', 'form found'); this.fill('form#__w2_b3oun76_login_form',{email:'email',password:'pass'},true); }); casper.waitforselector("form[name=search_form] input[name='search_input']", function(){ this.capture('google.png'); this.echo("page title " + this.gettitle()); }); casper.run();
Comments
Post a Comment