如何在遇到网页上的JS错误后让PhantomJS继续进行屏幕截图?页面在浏览器中正确呈现,而不是在PhantomJS屏幕截图中。
1页有效,1页失败:
PhantomJS无法捕获此页面上的图表:https://www.graf.ly/user_graphs/510。
PhantomJS在此页面上取得了成功:https://www.graf.ly/user_graphs/505。
错误:
似乎PhantomJS在页面上遇到错误并停止捕获。我使用调试模式从rasterize.js运行PhantomJS's tutorial脚本我在失败的页面上出现此错误:
TypeError: 'undefined' is not a function (evaluating 'function(e){this.visible=true;this.update(e)}.bind(this)')
https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.js:2
https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.js:2
https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.4.6/rickshaw.min.js:1 in klass
https://www.graf.ly/graph_templates/55/graph.js:278
https://www.graf.ly/graph_templates/55/graph.js:11
https://www.graf.ly/graph_templates/55/index.html?dataset=1208&options=2140:177 in ready
https://cdnjs.cloudflare.com/ajax/libs/queue-async/1.0.7/queue.min.js:1 in o
https://cdnjs.cloudflare.com/ajax/libs/queue-async/1.0.7/queue.min.js:1
https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.2/d3.min.js:1
https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.2/d3.min.js:1 in t
https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.2/d3.min.js:1 in u
答案 0 :(得分:0)
这个例外意味着幻影' JS引擎不支持bind
函数。尝试包括(直接在html页面中或通过使用includeJs或injectJs函数的phantomjs脚本)某些polyfill,如the one on MDN或es5-shim等...