读书人

代码提示CasperJs模拟登陆人人网(新浪

发布时间: 2013-04-21 15:31:38 作者: rapoo

代码提示CasperJs模拟登陆人人网(新浪微博登陆有问题) 代码提示

文章结束给大家来个程序员笑话:[M]

?

????登岸浪新微博却提示找不到对应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.assertExists('div[class="inp password"]', 'div[class="inp password"] is found');   7         this.test.assertExists('a[class="W_btn_g"]', 'submit button is found');   8         this.echo("inputs of name and pass both exists.");   9         this.echo('name=' + this.fetchText('input[class="name'));  10         this.echo('pass=' + this.fetchText('input[class="pass"]'));  11   12         this.echo('first location is ' + this.getCurrentUrl());  13         this.capture("login.png");  14         }  15 );  16   17 casper.then(function() {  18         this.wait(10000,function() {  19                 this.echo("I've waited for 10 seconds");  20         });  21 });  22   23 casper.then(function() {  24         this.fill('div[class="inp username"]', {'username':'%%%%@sina.com'}, false);  25         this.fill('div[class="inp password"]', {'password':'!!!???'}, false);  26         this.click('a[class="W_btn_g"]');  27         this.echo('clicked...');  28 });  29   30 casper.then(function() {  31         this.wait(10000,function() {  32                 this.echo("I've waited for 10 seconds again");  33         });  34 });  35   36 casper.then(function() {  37         this.echo('new location is ' + this.getCurrentUrl());  38         this.capture("logined.png");  39 });  40   41   42 casper.run();

?

?

文章结束给大家分享下程序员的一些笑话语录: 警告
有一个小伙子在一个办公大楼的门口抽着烟,一个妇女路过他身边,并对他 说, “你知道不知道这个东西会危害你的健康?我是说, 你有没有注意到香烟 盒上的那个警告(Warning)?”
小伙子说,“没事儿,我是一个程序员”。
那妇女说,“这又怎样?”
程序员说,“我们从来不关心 Warning,只关心 Error”

读书人网 >ASP

热点推荐