如何使用 HtmlUnit 获取 HTML 页面
我知道你可能认为这个问题很愚蠢,但我需要使用 HtmlUnit。但是,它以 XML 或文本形式返回页面。
我不知道如何获得纯HTML(与浏览器返回的源代码相同)
我需要这个,因为我需要使用一些编写的模块。有什么想法吗?
I know you may think this question is stupid, but I need to use HtmlUnit. However, it returns a page either as XML or as text.
I don't how to get the pure HTML (the same as the source code that browsers return)
I need this, because I need to use some written modules. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用以下代码来实现您的目标:
请参阅 WebResponse.html#getContentAsString() 方法的 javadocs。
You can use the following piece of code to achieve your goal:
See javadocs of the WebResponse.html#getContentAsString() method.