I am using PhantomJs and CasperJs to login with amazon it works fine, however after multiple times login amazon gives Captcha and my script fails. I dont know how to handle login script if it has captcha. Here is my current code which works fine if no captcha.
var casper = require('casper').create();
var AMAZON_USER = 'amazon-username';
var AMAZON_PASS = 'amazone-password';
casper.start('https://www.amazon.com/gp/wallet', function () {
this.echo('Loggin into amazon...');
var emailInput = 'input#ap_email';
var passInput = 'input#ap_password';
this.mouseEvent('click', emailInput, '15%', '48%');
this.sendKeys('input#ap_email', AMAZON_USER);
this.wait(3000, function () {
this.mouseEvent('click', passInput, '12%', '67%');
this.sendKeys('input#ap_password', AMAZON_PASS);
this.mouseEvent('click', 'input#signInSubmit', '50%', '50%');
});
});
casper.then(function (e) {
this.capture('amazon.png');//print screen shot after login
});
casper.run();
Thanks in advance.