CasperJS - Form fill() returns a 401 -


I am trying to test the original authentication web page.

I have it so far:

  var casper = require ('casper'). Make ({verbose: true, logLevel: 'debug'}); Casper.options.viewportSize = {width: 1366, height: 667}; Casper.start (); Casper.open ('http: //internal/page.php', {method: 'get', headers: {'authorization': 'Basic' + btoa ('Username: Password')}}). Response) {this.fill ('form [action = "page2.php"]', {cattype: 'BLAH2', needdate: '04 / 21/2014 '}, true);}); Casper.then (function () {this.capture ('screenshot-form-entry.png');}); Casper.run (function () {this.exit ();});   

The page opens properly (no authentication problems).

Form fields are set correctly.

The problem is a form submission.

This is called status = failed .

I see the server log and it gives a 401.

Why are not the certificates passed along with the submission of the form? Or maybe the question should be, how can I pass credentials?

After a few days of excavation, Answer that I found to do with it.

I'm not sure whether this is a bug or the way it's supposed to work.

For basic authorization, you have to set username / password to page settings .

This is the changed code.

  var casper = require ('casper'). Create ({verbose: true, logLevel: 'debug', page settings: {userName: 'uid', password: 'pwd'}}); Casper.start (); Casper.open ('http: //internal/page.php'). Then (function (feedback) {this.fill ('form [action = "page2.php"]', {cattype: 'BLAH2', needdate: '04 / 21/2014 '}, true);}); Casper.then (function () {this.capture ('screenshot-form-entry.png');}); Casper.run (function () {this.exit ();});    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -