n1k0/casperjs — Issue #60: fill() can't auto submit
Author: atian25
Created: 2012-02-27 12:54:49+00:00
State: open

the form is:

*code:*

var account = 'liuyong1';
var pwd = '123456';
casper.then(function(){
this.evaluate(function() {
// had read source of casper.js
var f = __utils__.findOne('form');
console.log('whether the form selector is right:'+ (f!=null))
});
this.fill('form',{
'account': account,
'password': pwd
},true);
this.click('input#submit');
this.capture('login.png');
});

*error:*

[info] [remote] whether the form selector is right:true
[info] [remote] attempting to fetch form element from selector: 'form'
[debug] [remote] Set "account" field value to liuyong1
[debug] [remote] Set "password" field value to 123456
[info] [remote] submitting form to unknown, HTTP POST
[info] [remote] TypeError: '[object HTMLInputElement]' is not a function
[debug] [phantom] Click on selector: input#submit