Skip to content

Get Headers after login western-union with casperjs #1

@ziflar

Description

@ziflar

Hello freind
I need to login western-union with casperjs and get all headers after login .
Trying to run my script i got on debug consol this error:

[warning] [remote] unable to submit form

here my code:

var casper = require('casper').create({
    verbose: true,
    logLevel: 'debug',
    waitTimeout: 5000,
    userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4',
    viewportSize:{width: 1600, height: 900}
})
.on('error', function(msg) {
    this.echo('Error: ' + msg, "ERROR");
})
.on('remote.message', function(msg) {this.echo('The error from evaluate: ' + msg, "ERROR");})
.start('https://www2.westernunion.com/fr/fr/send-money/app/login/', function() {
    //this
    //.click('#signin_link');
    this.wait(0,function(){var i=0;
    function snap(){i++;casper.capture('foo_'+i+'.jpg', undefined,{format: 'jpg',quality: 75});if(i<4){setTimeout(snap,1000)}}snap();
    })
    .fillSelectors('form', {
        '#txtEmailAddr' : 'tatatmarta@gmail.com',
        '#txtKey':  'tictac@2009'
    }, true)
    .waitForSelector("#btn-do-login",
    function success() {
        this
            
	    .echo('logged in!', 'INFO')
            .capture('in.png')
    },
    function fail(){
        this
            .capture('failed.png')
            .echo('failed to login', 'ERROR');
    })
})
//Header
.then(function dumpHeaders(){
  console.log("getting headers");
	this.currentResponse.headers.forEach(function(header){
    console.log(header.name +': '+ header.value);
  })
})
.run()

any help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions