After running phantomjs with _--remote-debugger-port=8080_ and trying to debug with Google Chrome (Version 39.0.2171.95) "about:blank" link is missing. Also I tried to forcefully go to http://127.0.0.1:8080/webkit/inspector/inspector.html?page=1 but that produces empty page with no debugging capabilities.
Tested on Windows 7 with PhantomJS 2.0 built from source.
The remote debugger works on Ubuntu with the latest PhantomJS master built from source, but the links to the webkit inspector are broken.
What's the HTML source of http://127.0.0.1:8080 ?
For me it's:
<html><head><title>Remote Web Inspector</title></head><body><ul>
<li><a href="/webkit/inspector/inspector.html?page=1"></li>
</ul></body></html>
The link http://localhost:8080/webkit/inspector/inspector.html?page=1 though works on Ubuntu, maybe it's more broken on Windows.
With http://127.0.0.1:8080 I'm getting exactly the same HTML source that you are getting.
But by following the link http://localhost:8080/webkit/inspector/inspector.html?page=1 browser is getting empty page with 404 status: HTTP/1.0 404 Not OK
Confirmed.
I don't think this is fixing the problem (tested in Windows only). Remote debugger inspector page still not shows _about:blank_ link. This time opening http://127.0.0.1:8080/webkit/inspector/inspector.html?page=1 in Chrome will load inspector page, so no more 404 code, but debugging is still not working. You can't set proper breakpoints inside ___run_ function (or you can but they are ignored), though you can execute script with ___run()_ call from console. I also noticed that GUI is different from what we had in PhantomJS 1.9 (probably because of newer WebKit version).
This is workaround that works for me, in _utils.cpp_ replace _loadJSForDebug_ with this:
bool loadJSForDebug(const QString& jsFilePath, const QString &jsFileLanguage, const Encoding& jsFileEnc, const QString& libraryPath, QWebFrame* targetFrame, const bool autorun)
{
QString scriptPath = findScript(jsFilePath, libraryPath);
QString scriptBody = jsFromScriptFile(scriptPath, jsFileLanguage, jsFileEnc);
if (!autorun) {
scriptBody = "function __run() {\n" + scriptBody + "\n}";
}
targetFrame->evaluateJavaScript(scriptBody, QString("debugger"));
return true;
}
Then while remote debugging there will be _(no domain)_ item in _Sources_ panel and inside of it will be _debugger_ from where you can properly set breakpoints. Also for me this _debugger_ page is accessible and can be seen only using arrow keys and not by mouse.
Side effect is that there is no more need for _remote_debugger_harness.html_ resource.
@iradul can you please show me a small example? In my case I can debug JS code (on Windows).
Using PhantomJS 2.0 binary built from source (remote debugging with binary from website doesn't work at all) and running remote debugger on this _test.js_ script:
require('webpage').create().open('http://google.com', function() {
console.log('ok!');
phantom.exit();
});
phantomjs.exe --remote-debugger-port=8080 test.js
with Google Chrome I'm getting this:
Now if I open http://localhost:8080/webkit/inspector/inspector.html?page=1 manually see below:
I'm getting same behavior on 3 different Windows 7 machines.
@Vitallium With your check-in in 2.0 branch (to include Web Inspector resource, from around Jan 24), I assume this issue is fully addressed? If yes, then probably it's a good idea for us to roll out 2.0.1 with this fix.
@ariya I can, but there are still a small bunch of issues, that I'd like to fix. I'll list them here #12970
@Vitallium Those can still go to 2.1, don't they?
@ariya I think so.
Can anyone confirm that the changes done in February fix the reported issue?
PhantomJS is completely new to me, but when I did a build two days ago on Windows (branch 2.0 - I can see the changes) I still see the behavior described by iradul on Feb. 2nd in this thread.
Has anybody else tried to buld PhantomJS from sources - and saw a working debugger?
Issue is not completely fixed, as I explained here.
@iradul, I asked because the fix was done on Feb 5th - your comment was written on Feb 2nd (see fix here: https://github.com/ariya/phantomjs/commit/8e8546b39c7cf807b4033fe4404f8ba2db90ec52).
So I thought when I read the thread that it is actualy fixed (or: should be...).
Thanks for your statement here, again, that it isn't completely fixed.
One idea when PhantomJS Release 2.0.1 will be available to download?
Still seeing the issues that @iradul was seeing on Feb 5th. Any ETA on 2.0.1?
Fixed in https://github.com/ariya/phantomjs/commit/8b79f62faf7335b8498770e01122b15d1405684b
Thanks @iradul!
How can I get this patch? Is there a release planned for 2.0.1? I'm trying to debug with 2.0 and found this issue. I ran build.cmd, but don't have nmake or qmake or Perl setup on my Windows machine.
Thank you.
I'm getting the page with just the dot, then when I go to the directory listed in the source html, I see a blank page.
(I'm using Phantom 2.0 downloaded from the phantom site, with Windows 8 and Chrome 44)
any tips on building from master on mac os x yosemite so i can get this patch
really hoping to get new releases (both for osx and windows) soon. pleeeease :pray: :pray: :pray:
@Vitallium you should consider reopening this issue, after testing on the current master branch it looks like phantom's script body is missing from sources tab:
phantomjs --remote-debugger-port=8080 test.js
I have a fix for this.
@iradul uh, I thought we got it fixed.
I can confirm I'm still experiencing the same issue on windows with the latest release.
I am trying this with version 2.0.0
on Windows 8.1 and seeing empty page
Landed in master! Thanks!
https://github.com/ariya/phantomjs/commit/0e32928ae167b1f756a8324bd1602200f6e9227e
I am new here so sorry for silly question - How do I know when this fix will be released? Is there a way I can use this fix right away?
The about:blank link is missing for me as well when remote debugging. I'm using phantomjs 2.1.1 on windows 10. I ran at the command line:
phantomjs --remote-debugger-port=9000 --remote-debugger-autorun=true practice2/chapter01/recipe08.js
However a link to the js file I want to debug is displayed. But Breakpoints are not being hit in the web inspector and nothing is written to the console after entering __run().
You should not use --remote-debugger-autorun=true
With that option on phantom will immediately execute __run()
internally so while you're loading localhost:9000
into Chrome your phantom script probably already ended.
I think this is a dupe issue which is open.
I ran:
phantomjs --remote-debugger-port=9000 practice2/chapter01/recipe08.js
and
phantomjs --remote-debugger-port=9000 --proxy-type=none practice2/chapter01/recipe08.js
Breakpoints are still not being hit and __run() does not output anything.
I'm seeing the same thing, the console doesn't actually run the __run()
command, it inserts a newline in Chrome. The console doesn't work at all in Firefox. It works perfectly in safari though.
Same issue. __run()
+ enter just adds a line feed on the console window and I am unable to get it running. Chrome on Ubuntu 16.10.
I have also verified that this failed on using Chrome and Firefox but works with Safari
@wgiroir what OS are you using? I couldn't get it working on Safari on Win7.
I'm safari + OSX
I was running Safari on OSX and phantomjs on CentOS 7
I could run the debug using a very old Chrome version (Chrome 17) that I download here (run sandboxie-d as I can't confirm the procedence of it, although it worked with me - do not use it for browsing, use it for debugging your PhantomJS scripts only).
Arora works for me! It's a browser based on Qt and WebKit and displays pages like Safari does. I tried Chrome on Ubuntu 16.10 as well as Safari 5.0.5 in Wine but Arora is (so far) the only browser that executes __run()
Any word on this? I'm running PhantomJS 2.1.1 on OSX and the debugger simply doesn't work in any browser I try. I get the same thing others have reported: Entering the __run()
command returns nothing, and no breakpoints are ever hit.
For those like me still having trouble, I've found that using an old version of Chromium works well, if your default browser is Chrome. Here's a link to a 2014 build of Chromium that I've had luck getting to work with PhantomJS's remote debugger: https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Mac%2F280075%2Fchrome-mac.zip?generation=1409176787550000&alt=media
@lewisd, I can confirm I can get chrome debugger to work in the old Chromium version. Will try and understand why this is and post on here if I find anything. I have been looking for other remote debugging breakpoint options for casperjs and will post here if I find anything that works as well. Seems like we need to add support for latest Chrome though.
For those who use Code editor, you can use PhantomJS debugger extension.
This is because the protocol used by Chrome changed after the Webkit- Blink engine split.
This issue should be re-opened, no?
@iradul thanks for the heads up on the Code editor debugger extension -> do you happen to know runtime configuration required for a Mac? Took a quick look here so far and played a bit with it but no success so far.
@jumoreno, hmm never tested on Mac but should be straight forward if you follow steps from documentation, check those out:
https://marketplace.visualstudio.com/items?itemName=iradul.debugger-for-phantomjs
https://github.com/iradul/vscode-phantomjs-debug (raise an issue if needed)
@jumoreno Also on a Mac it should work using Safari since IIRC it still uses the same protocol (WebKit based)
This must help: https://github.com/node-inspector/node-inspector/issues/951#issuecomment-262441472
anyone have workaround for this problem?
@mingjunz, two workrounds:
Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!
Most helpful comment
I'm seeing the same thing, the console doesn't actually run the
__run()
command, it inserts a newline in Chrome. The console doesn't work at all in Firefox. It works perfectly in safari though.