Hi allm I would like to know how to get an input value with casperjs
This is my html element
<input type="hidden" name="key" value="newkey">
This is what I have tried:
view = 'users/registered';
casper.test.begin("Activating account", 5, function register(test){
casper.start(webroot + view, function(){
}).then(function(){
this.echo("Retrieving data from hidden input key", "COMMENT");
activationKey = this.evaluate(function() {
return __utils__.getFieldValue('key');
});
}).then(function(){
this.echo("Activating account with the key \"" + activationKey + "\"", "COMMENT");
window.location = webroot + activationKey;
});
casper.run(function() {
this.echo('Account activated successfully', 'SUCCESS').exit();
test.done();
});
});
casper.viewport(page.width, page.height);
In this case return null
I have also tried:
activationKey = __utils__.getFieldValue('key');
but return me this error:
FAIL ReferenceError: Can't find variable: __utils__