繁体   English   中英

node.js解析页面并捕获外部前端js错误

[英]node.js parse a page and catch external frontend js errors

是否可以解析具有某些js错误(例如,“未定义$”)的外部页面http://example.com ,捕获这些错误并通过console.log()打印它们?

对的,这是可能的。 基本上,您需要下载页面并在无头浏览器(例如PhantomJS)中呈现它。

有人已经这样做了: http : //npmjs.com/package/phantom-check

$ phantom-check http://example.com
Phantom is checking http://example.com

[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: http://example.com/, HTTP GET
[debug] [phantom] Navigation requested: url=http://example.com/, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "http://example.com/"
[debug] [phantom] Successfully injected Casper client-side utilities

Page http://example.com has no errors

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM