forked from ractivejs/ractive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-phantomjs-debug.js
38 lines (29 loc) · 1.37 KB
/
bootstrap-phantomjs-debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
from http://phantomjs.org/troubleshooting.html
1. start on command line with remote-debugger-port option:
$ractive> node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/lib/phantom/bin/phantomjs --remote-debugger-port=9000 bootstrap-phantomjs-debug.js
2. navigate to debugging port in web browser (localhost:9000)
3. get first web inspector for phantom context (click about:blank)
4. from the web browser console execute __run(), which will hit first debugger point
5. navigate to debugging port in a second web browser tab (go to localhost:9000 again, you'll see the target file listed)
6. get second web inspector (click on link in #5)
7. return to the first web inspector tab and click continue on debugger
8. navigate back to second tab and you should find debugger waiting
For many issues:
9. Make sure break on exceptions is selected (blue pause)
10. Run (F8)
11. Open console and look for errors
*/
//set your page here
var url = 'tmp-build/test/tests/css.html',
page = require('webpage').create();
page.onLoadFinished = function(status) {
console.log('status', status)
//phantom.exit(); ignored by debug anyway
};
page.open(url, function(status) {
debugger; // pause here in first web browser tab for steps 5 & 6
page.evaluateAsync(function() {
debugger; // step 7 will wait here in the second web browser tab
});
});