[html]
/** Creating an array to store form data*/
/** Filling array with form data */
fields[‘//*[@id=”ext-gen1089″]’] = “first text box”;
fields[‘//*[@id=”ext-gen1091″]’] = “second text box”;
/** Passing the data array to the full to store data in the form
* To capture the form with data, we donot submit the form by passing
* false signal in third paramter of fillXPath function
* */
this.fillXPath(‘form[name=”hasanForm”]’, fields, false);
this.capture(“Screenshotbefore_submit.png”);
});
casper.then(function(){
// you can use fillxpath again using third parameter true to submit the form
//this.fillXPath(‘form[name=”hasanForm”]’, fields, true);
this.click(x(“.//*[@id=’button-1054-btnEl’]”));
});
casper.then(function(){
this.capture(“Screenshotafter_submit.png”);
});
casper.run(function(){
test.done();
});
});
[/javascript]