您好我正在尝试在PhantomJS中编写一个webcrawler类型的脚本。
以下是代码:
var page = require('webpage').create();
page.onCallback = function() {
page.render('snapshot.png');
phantom.exit();
};
page.open('http://somesitewithangularscripts.com');
然而它一直在给我错误:
ReferenceError: Can't find variable: angular
从我在线阅读的内容中,我需要告诉幻像角度库在我的本地机器上的位置?但我找不到任何关于如何做到这一点的指南/文档/教程。
顺便说一句,我通过机器上的npm框架运行所有内容。
PhantomJs版本:1.9.8
错误消息:
Unable to load resource (#19URL:https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#22URL:https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#39URL:https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular.min.js)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#40URL:https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular-sanitize.min.js)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#41URL:https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular-animate.min.js)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#42URL:https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular-route.min.js)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#43URL:https://ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular-cookies.min.js)
Error code: 6. Description: SSL handshake failed
ERROR: ReferenceError: Can't find variable: angular
TRACE:
-> http://na.lolesports.com/profiles/lolesports_profile/modules/custom/esports/esports_directives/js/ngModules.js?nu5xd5: 63
-> http://na.lolesports.com/profiles/lolesports_profile/modules/custom/esports/esports_directives/js/ngModules.js?nu5xd5: 66
ERROR: ReferenceError: Can't find variable: angular
TRACE:
-> http://na.lolesports.com/sites/all/libraries/angular-truncate/src/truncate.js?nu5xd5: 1
ERROR: ReferenceError: Can't find variable: angular
TRACE:
-> http://na.lolesports.com/sites/all/libraries/angular-timer/angular-timer.min.js?nu5xd5: 8
ERROR: ReferenceError: Can't find variable: angular
TRACE:
-> http://na.lolesports.com/profiles/lolesports_profile/modules/custom/esports/esports_directives/js/esportsDirectives.js?nu5xd5: 8
ERROR: ReferenceError: Can't find variable: angular
TRACE:
-> http://na.lolesports.com/profiles/lolesports_profile/modules/custom/esports/esports_directives/js/filters/esportsFilters.js?nu5xd5: 3
ERROR: ReferenceError: Can't find variable: angular
TRACE:
-> http://na.lolesports.com/profiles/lolesports_profile/modules/custom/esports/esports_directives/js/esportsServices.js?nu5xd5: 8
ERROR: ReferenceError: Can't find variable: angular
TRACE:
-> http://na.lolesports.com/profiles/lolesports_profile/modules/custom/esports/js/esportsApp.js?nu5xd5: 8
ERROR: TypeError: 'undefined' is not an object (evaluating 'esportsDirectives.controller')
TRACE:
-> http://na.lolesports.com/profiles/lolesports_profile/modules/custom/esports/esports_directives/js/controllers/MatchController.js?nu5xd5: 6
Unable to load resource (#111URL:https://cdn.leagueoflegends.com/riotbar/prod/1.5.2/images/bar/bg-bar.jpg?1435084967)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#112URL:https://cdn.leagueoflegends.com/riotbar/prod/1.5.2/images/bar/icon-game-lol.png?1435084967)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#113URL:https://cdn.leagueoflegends.com/riotbar/prod/1.5.2/images/account/sprites-sacb8a8a753.png)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#114URL:https://cdn.leagueoflegends.com/riotbar/prod/1.5.2/images/bar/dropdown-trigger-blue.png?1435084967)
Error code: 6. Description: SSL handshake failed
Unable to load resource (#152URL:https://stats.g.doubleclick.net/r/collect?t=dc&aip=1&_r=3&v=1&_v=j38&tid=UA-37673467-1&cid=123674724.1441623986&jid=1834200343&_u=SGAAgAQi~&z=790116041)
Error code: 6. Description: SSL handshake failed
CONSOLE: Unsafe JavaScript attempt to access frame with URL http://tpc.googlesyndication.com/safeframe/1-0-2/html/container.html from frame with URL http://na.lolesports.com/na-lcs/2015/spring/matches/week-1/team-solomid-vs-cloud9. Domains, protocols and ports must match.
(from line #undefined in "undefined")
CONSOLE: Unsafe JavaScript attempt to access frame with URL http://tpc.googlesyndication.com/safeframe/1-0-2/html/container.html from frame with URL http://na.lolesports.com/na-lcs/2015/spring/matches/week-1/team-solomid-vs-cloud9. Domains, protocols and ports must match.
(from line #undefined in "undefined")
CONSOLE: Unsafe JavaScript attempt to access frame with URL http://tpc.googlesyndication.com/safeframe/1-0-2/html/container.html from frame with URL http://na.lolesports.com/na-lcs/2015/spring/matches/week-1/team-solomid-vs-cloud9. Domains, protocols and ports must match.
(from line #undefined in "undefined")
Unable to load resource (#153URL:https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js)
Error code: 6. Description: SSL handshake failed