Commit 057c2a04 057c2a04ef4f616ec19800431f3dc0f4c35d633e by Nicolas Perriault

added documentation for Casper#fill()

1 parent 1d73e498
Showing 1 changed file with 26 additions and 0 deletions
...@@ -424,6 +424,32 @@ casper.start('http://www.google.fr/', function(self) { ...@@ -424,6 +424,32 @@ casper.start('http://www.google.fr/', function(self) {
424 }); 424 });
425 ``` 425 ```
426 426
427 ### Casper#fill(String selector, Object values)
428
429 Fills the fields of a form with given values.
430
431 Example:
432
433 ```javascript
434 casper.start('http://some.tld/contact.form', function(self) {
435 self.fill('form#contact-form', {
436 'subject': 'I am watching you',
437 'content': 'So be careful.',
438 'name': 'Chuck Norris',
439 'email': 'chuck@norris.com',
440 });
441 self.click('input[type=submit]');
442 }).then(function(self) {
443 self.evaluateOrDie(function() {
444 return /message sent/.test(document.body.innerText);
445 }, 'sending message failed');
446 }).run(function(self) {
447 self.echo('message sent').exit();
448 });
449 ```
450
451 **WARNING:** Please don't use Casper nor PhantomJS to send spam, or I call the Chuck.
452
427 ### Casper#repeat(int times, function then) 453 ### Casper#repeat(int times, function then)
428 454
429 Repeats a navigation step a given number of times. 455 Repeats a navigation step a given number of times.
......