Tuesday, 15 May 2012

javascript - Submitting a form with casperjs -



javascript - Submitting a form with casperjs -

i have simple form submit using casperjs. same, have next version of code -

casper.then(function() { // fill dropdown , click on purchase this.fill('form#add-to-cart-form', { 'options[416]': '2884', 'productid': '1093' }, true); }); casper.then(function() { console.log("checkout url: ", this.getcurrenturl()); // not going correctly });

the problem here same url getting logged program, whereas if open page , submit it, goes checkout page.

any clue going wrong?

the site seems single page application. page load of submit button isn't picked casperjs. need manually wait next page load. used selector can find on cart page not on product page: .filled-cart

the other problem fill method didn't trigger form submit. need manually click it. removed fill hidden field, doesn't create sense.

casper.then(function() { // fill dropdown , click on purchase this.fill('form#add-to-cart-form', { 'options[416]': '2884' }); this.click("button[type=submit]"); }); casper.waitforselector(".filled-cart"); casper.then(function() { console.log("checkout url: ", this.getcurrenturl()); // not going correctly });

javascript casperjs

No comments:

Post a Comment