文章结束给大家来个程序员笑话:[M]
//登岸人人代码 1 var casper = require('casper').create(); 2 casper.start('http://www.renren.com', function() { 3 this.fill('form[id="loginForm"]', { 4 'email': 'XXXX@gmail.com', 5 'password': '********' 6 }, false); 7 }); 8 9 casper.then(function() { 10 this.click('input[class="input-submit login-btn"]'); 11 12 this.echo('clicked...'); 13 }); 14 15 casper.then(function() { 16 this.echo(this.getTitle()); 17 }); 18 casper.run();
截图如下:
????
?
????登岸浪新微博却提示找不到对应name,代码如下:
1 var casper = require('casper').create(); 2 3 4 casper.start('http://www.weibo.com/', function() { 5 this.test.assertExists('div[class="inp username"]', 'div[class="inp username"] is found'); 6 this.test.asser