Javascript phantomjs-在客户端代码上设置断点
我发现其中提到了一种运行调试器的方法,但我似乎无法让它工作。我试图让最基本的例子发挥作用,但惨遭失败。即 教程中的runner.js示例 我做错了什么?我希望有一个repl或调试接口之类的东西,我是否误解了文档 编辑:只是为了澄清localhost:9000和调试器;这句话确实被忽略了——比如说,有“你好,世界;”在控制台中Javascript phantomjs-在客户端代码上设置断点,javascript,debugging,phantomjs,Javascript,Debugging,Phantomjs,我发现其中提到了一种运行调试器的方法,但我似乎无法让它工作。我试图让最基本的例子发挥作用,但惨遭失败。即 教程中的runner.js示例 我做错了什么?我希望有一个repl或调试接口之类的东西,我是否误解了文档 编辑:只是为了澄清localhost:9000和调试器;这句话确实被忽略了——比如说,有“你好,世界;”在控制台中 var page = require('webpage').create(), system = require('system'), t, address; i
var page = require('webpage').create(),
system = require('system'),
t, address;
if (system.args.length === 1) {
console.log('Usage: loadspeed.js <some URL>');
phantom.exit();
}
t = Date.now();
address = system.args[1];
page.open(address, function(status) {
if (status !== 'success') {
console.log('FAIL to load the address');
} else {
t = Date.now() - t;
console.log('Loading time ' + t + ' msec');
}
phantom.exit();
});
<html>
<head>
<title>Script</title>
</head>
<body>
<h1>Script</h1>
</body>
<script>
debugger;
console.log("hello world;")
</script>
</html>
$ phantomjs --remote-debugger-autorun=yes --remote-debugger-port=9000 /tmp/runner.js /tmp/test.html
Loading time 6 msec
Phantom::exit() called but not quitting in debug mode.
^C%
$ phantomjs --remote-debugger-autorun=yes /tmp/runner.js /tmp/test.html
Loading time 6 msec
$ phantomjs /tmp/runner.js /tmp/test.html
Loading time 6 msec