admin管理员组文章数量:1394985
page.evaluate(function() { return document; }, function(result){
console.log(result)
next();
});
result is actually a huge object. I don't know the properties and attributes of that object. I just want the HTML of the page as you would see it in Chrome inspector
.
From the look of the object, it seems that the HTML includes CSS and javascript..which is weird. The user should not see the CSS and javascript, because they are not the web page's HTML. Those are external files. I only want the HTML that the user would see.
page.evaluate(function() { return document; }, function(result){
console.log(result)
next();
});
result is actually a huge object. I don't know the properties and attributes of that object. I just want the HTML of the page as you would see it in Chrome inspector
.
From the look of the object, it seems that the HTML includes CSS and javascript..which is weird. The user should not see the CSS and javascript, because they are not the web page's HTML. Those are external files. I only want the HTML that the user would see.
Share Improve this question asked May 23, 2013 at 6:15 TIMEXTIMEX 273k368 gold badges802 silver badges1.1k bronze badges1 Answer
Reset to default 7The type of document
is an HTML document. To get the entire DOM as a string, you could do document.documentElement.outerHTML
.
From outside evaluate
, you can use page.content
. It is a string.
I don't know what you mean by "HTML includes CSS and JavaScript" or "the web page's HTML". Are you referring to the difference between the page source and the DOM as modified by scripting? Both the above give you the current DOM, not the original page source.
本文标签: javascriptUsing Phantomjs evaluatehow can I get the HTML of the pageStack Overflow
版权声明:本文标题:javascript - Using Phantom.js evaluate, how can I get the HTML of the page? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744107075a2591112.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论