2

CasperJS doesn't open some sites. Example - https://play.google.com. PhantomJs opens Google Play and hasn't any problems. But Casper doesn't want.

Casper returns

<html><head></head><body></body></html>

I tried add

--ignore-ssl-errors=true

--ssl-protocol=tlsv1 OR --ssl-protocol=any

--web-security=no

And again <html><head></head><body></body></html>

Nothing helps. What I can do for this? I need functions of Casper and I can't use Phantom.

my Js file:

var casper = require('casper').create();

var url = casper.cli.get(0);



casper.userAgent ( 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36' );

casper.start(url, function() {

/* func here */

var js = this.evaluate(function() {

    return document; 

}); 


this.echo ( js.all[0].outerHTML );                     

});

casper.run();

Maybe someone has an idea? What the problem?

Thanks.

antobra
  • 21
  • 2
  • Are you sure that CasperJS uses the same version of PhantomJS as the one that you used to open google play? When you install it through npm, CasperJS installs a private version of PhantomJS. This is a full casper script to check it: `console.log(JSON.stringify(phantom.version));phantom.exit();` – Artjom B. Feb 02 '15 at 14:19

2 Answers2

0

I think i understand.

I created heavy page (more then 1 mln symbols) and tried open via Phantom and it works. And when I tried Casper it is crushed or it returned empty HTML code. The problem in big pages and Casper.

Casper can't handle heavy pages. I use last version.

antobra
  • 21
  • 2
0

I found on other threads that this issue comes when opening https sites with CaperJS. See the discussion here.

Based on their input I added '--ssl-protocol=any' to the CaperJS call and it solved the issue.

I also found the same answer here on stackoverflow.

takacsmark
  • 3,933
  • 23
  • 26