Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CasperJS remote debugging option

I am trying to use remote debugging option for casperJS.

I am running this on port 6666.

$casperjs --remote-debugger-port=6666 myscript.js

The debugger starts and I am able to access WebKit inspector on url

http://localhost:6666/ 

I am seeing first URL as about:blank.

When I click on it, Web Page inspector loads.

When I type _run() in console, I am getting

Reference Error, _run is not defined error.

I am not able to go ahead further. Please let me know if I need to do corrections somewhere.

Also, do I have to set explicit breakpoints in CasperJS script. If I have to, then how ?

UPDATE 1

Tried --remote-debugger-autorun=yes

$casperjs --remote-debugger-port=6666 --remote-debugger-autorun=yes myscript.js

This runs the script immediately as stated in help. However, the debugger still runs and process does not exit.

OUTPUT

Now I can see requested URL below about:blank.

When I click on about:blank or requested url, WebKit inspector opens.

But I am stuck again.

UPDATE 2

Also tried to execute examples ported with phantomJS.

Result is same. I am stuck on a blank WebKit Inspector window.

like image 550
Learn More Avatar asked Jan 02 '13 06:01

Learn More


People also ask

How do I enable remote debugging in Windows 10?

In the Windows Start menu, search for and open Windows Firewall, and select Allow an app through Windows Firewall. Make sure Remote Debugger or Visual Studio Remote Debugger appears in the Allowed apps and features list with a selected check box, and the correct network types are selected.

How do I connect to Visual Studio Remote Debugger?

Make sure the remote debugger is running on the target machine (If it's not, search for Remote Debugger in the Start menu). The remote debugger window looks like this. In Visual Studio, start debugging (Debug > Start Debugging, or F5). If prompted, enter network credentials to connect to the remote machine.


1 Answers

Try __run() instead of _run().

You can also place breakpoints at design time when you write "debugger;" in your script. The debugger will break at those lines.

I have another problem I am researching now - the casper.exit() function doesn't terminate the phantom process. It displays the following line:

Phantom::exit() called but not quitting in debug mode.

One needs to kill the process manually...

like image 54
Dimitar Avatar answered Sep 30 '22 05:09

Dimitar