javascript - Unable to verify form has been filled out with CasperJS & jQuery -


i have got form trying fill using casperjs. code doesn't appear have problems (no errors being returned) - seem unable 'check' form has been filled out.

when dump 'first_name' appears blank - though have set filled string 'joe' - ideas doing wrong?

casper.start(url); casper.then(function() {     this.fill('form[name="phones_display"]', {         'first_name'            : 'joe', // required         'last_name'             : 'bloggs', // required         'check_payable'         : '', // name cheque if different name         'payment_method'        : 'check', // required check, paypal         'shipping_method'       : '', // envelope, fedex         'email_address'         : 'joe@bloggs.com', // required         'paypal_email_address'  : '',         'telephone_number'      : '12345678', // required         'street_address_1'      : '', // required         'street_address_2'      : '',         'city'                  : '', // required         'state'                 : '',         'zip_code'              : '', // required         'hear'                  : '',         'otherreason'           : ''     }, true); });  casper.then(function() {     var first_name = this.evaluate(function() {         return $('input[name="first_name"]').val();     });      require('utils').dump(first_name); }); casper.run(); 

it happens because after fill form, submitted. when try input 'the first name', form has been cleaned. in order avoid this, change third parameter of casper.fill() method false.

fill(string selector, object values[, boolean submit]) 

example:

this.fill('form[name="phones_display"]', {     'first_name'            : 'joe', // required     'last_name'             : 'bloggs', // required      ....  }, false); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -