casper.then(function(){
phone_number = '7wqeqwe6';
phone_password = 'Teqweqweqw34';
});
casper.thenEvaluate(function(phone,password) {
document.querySelector('input#myTMobile-phone').setAttribute('value',phone);
document.querySelector('input#myTMobile-password').setAttribute('value',password);
// document.querySelector('form').submit();
}, {
phone : phone_number,
password : phone_password
});
this throws me
string(307) "[37;41;1mFAIL[0m ReferenceError: Can't find variable: phone_number
Is there a way to pass params to evaluate method?
Try something like this:
var phone_number = '7wqeqwe6',
phone_password = 'Teqweqweqw34';
casper.start('http://…');
casper.thenEvaluate(function(phone, password) {
document.querySelector('input#myTMobile-phone').setAttribute('value', phone);
document.querySelector('input#myTMobile-password').setAttribute('value', password);
// document.querySelector('form').submit();
}, {
phone: phone_number,
password: phone_password
});
Notes: