Debug "about: blank" in CasperJs

I have the following simple casperjs script (I cannot name the actual URL) on a Windows 7 machine:

var casper = require('casper').create({verbose:true,logLevel: "debug"}); casper.start('https://[XXX].de', function() { console.log(this.getCurrentUrl()); }); casper.run(); 

Output states that it failed - and the current URL is: "about: blank"

 [info] [phantom] Starting... [info] [phantom] Running suite: 2 steps [debug] [phantom] opening url: https://[XXX].de, HTTP GET [debug] [phantom] Navigation requested: url=https://[XXX].de, type=Other, lock=true, isMainFrame=true [warning] [phantom] Loading resource failed with status=fail: https://[XXX].de [debug] [phantom] Successfully injected Casper client-side utilities about:blank [info] [phantom] Step 2/2: done in 39205ms. [info] [phantom] Done 2 steps in 39309ms 

When you submit a GET request with the Firefox RESTCLient plugin, I get:

 Status Code: 200 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection: close Content-Type: text/html Date: Tue, 11 Dec 2012 11:09:37 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Pragma: no-cache Server: unknown Transfer-Encoding: chunked 

My question is:

How can I debug this? Is this a known issue?

+4
source share
2 answers

It seems that the command line arguments passed to casperjs are not passed to PhantomJS. I also ran into this problem and fixed it. I ran the script as follows:

 PhantomJS.exe --ignore-ssl-errors=true myscript.js 

When I tried to pass parameters in another way

 PhantomJS.exe myscript.js --ignore-ssl-errors=true 

it does not work and gives the same error you encountered.

+4
source

To pass phantomjs parameters to casperjs , you can directly update the casper binary ( casperjs.py on linux or casperjs.bat on windows).

On Linux, open casperjs.py , update the CASPER_COMMAND array, which forms the phantomjs command and executes.

To add "--ignore-ssl-errors = yes", add CASPER_COMMAND as follows:

 CASPER_COMMAND.extend(['--ignore-ssl-errors=yes']); 

For the same, in the windows or for more information can be found here

+3
source

All Articles