美文网首页
CasperJS login before Scraping

CasperJS login before Scraping

作者: RoyTien | 来源:发表于2017-06-06 10:09 被阅读24次

Set up CasperJS


var casper = require('casper').create();

Start with login page


casper.start('the url of login page', function() {
  // Login Founction Two
  this.sendKeys('form#id input#email', 'your email');
  this.sendKeys('form#id input#password', 'your password');
  this.click('form#id input[type="submit"]');
});

Wait one second so that server can valid login information


casper.wait(1000, function() {
});

casper.thenOpen('the normal page url', function() {
  this.evaluate(your own method);
});

相关文章

网友评论

      本文标题:CasperJS login before Scraping

      本文链接:https://www.haomeiwen.com/subject/itrgfxtx.html