Reputation: 139
cannot get my function to return data correctly i want to grab the value of this inputbox
<input type="text" value="[email protected]" maxlength="100" size="40" name="mail"></input>
so i built a function like so
exports.Details = function() {
casper.thenOpen("https://perfectmoney.is/settings.html", function() {
var fetch = casper.fetchText('#reg > table:nth-child(3) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > table:nth-child(4) > tbody:nth-child(1) > tr:nth-child(8) > td:nth-child(2) > input:nth-child(1)')
});
};
i am then calling my function like so
casper.then(function() {
var item = pief.Details();
console.log(item);
});
the result i get is undefiend how can i fix this
Upvotes: 0
Views: 4089
Reputation: 1601
casper.then(function(){
value = this.evaluate(function() {
return __utils__.findOne('input').getAttribute('value');
});
});
casper.then(function(){
this.echo(value);
});
I recommend you to add an id for this input. And search by input#id_name.
Upvotes: 2