1

I try this very simple script :

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

casper.on('remote.message', function(msg) {
    this.echo('remote: ' + msg);
})

casper.start('http://stackoverflow.com');

casper.thenEvaluate(function(){
    var ps = document.querySelectorAll('*');
    console.log("DEBUG ps.length="+ps.length);

})

casper.run(function() {
     this.exit();
});

then I run

casperjs --remote-debugger-port=9035 script.js

Then I open http://127.0.0.1:9035 in chrome, click on the bootstrap.js link, then open console tab, type __run(), but all get hangs.

Is this feature supposed to work properly ?

Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223
MevatlaveKraspek
  • 2,246
  • 3
  • 20
  • 23

1 Answers1

1

I was also stuck on this several hours, and didn't fix this completely.

Still I can give you some hints.

  1. Using another browser,In my case, using Safari instead of Chrome. https://github.com/ariya/phantomjs/issues/12864
  2. Using phantomjs to check the code if work well.

    // casperscript.js phantom.casperPath = '/path/to/casperjs'; phantom.injectJs(phantom.casperPath + '/bin/bootstrap.js');

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

  3. After step1/step2, maybe you still get other issues(such like crash)..So you'd better add resource listener or capture screenshots to see what really happened.

inza9hi
  • 114
  • 1
  • 10