When using Casperjs to fill and submit forms, it is necessary to manually input the data each time. On the other hand, Faker.js can generate fake data that can be used in forms. The question then arises - how can these two be combined effectively? Consider the following example:
var casper = require('casper');
var Faker = require('./Faker');
casper.start('http://contact.form', function() {
this.fill('form#contact-form', {
'name': 'Chuck Norris',
'email': '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="42212a372129022c2d2b3c62443230">[email protected]</a>',
}, true);
});
casper.start('http://contact.form', function() {
this.fill('form#contact-form', {
'name': Faker.Name.findName(),
'email': Faker.Internet.email(),
}, true);
});
Do you think this approach is accurate or not?