Thank you! Your feedback has been delivered
Thank you! Your feedback has been sent

Not able to login on a website using casperjs

I am trying to login to this website http://www.shopclues.com but am unable to do so. Its quite urgent as other processes are stuck due to same.

It would be great if one can come up with a solution script for the same for the mentioned bounty.

User Gravatar

lavesh

Posted Oct 1 2013 22:42 UTC

$25


  • Assigned To user486
  • Solved
  • casperjs
  • 1359 Views

2 Replies


what exactly is unsuccessful? Do you get an error of some kind? can you show your code?

User Gravatar

guyisra

Posted Oct 2 2013 5:32 UTC

It is necessary to use Phantomjs 1.9.2 with casperjs 1.0.3

//create casper object
var casper = require('casper').create({
    loadImages:false,
    verbose: true,
    logLevel: 'debug'
});

//set browser user agent
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)');

//Open URL
casper.start('http://www.shopclues.com/');

casper.then(function() {
    // Click SIGN IN
    this.click('div#login_user_data a:first-child');
});

casper.then(function() {

    //fill form
    this.fill('form[name=login_form]', {
        'user_login' : 'youruser@email.com',
        'password' : 'xxxxxxxx'
    }, false);              

    //submit form
    this.thenClick('input.ml_function_button', function(){

        // Here I'm in my myAccount Page        
        this.capture('screen.png');    

        // Do something ...
    });

});

casper.run(function() {
    //finish execution script 
    this.exit();
});
User Gravatar

user486

Posted Oct 3 2013 15:15 UTC

Solution

This didn't solve your task? Get your own custom solution.

Add a reply

By posting a reply on CodersClan you agree to our Terms & Conditions