java - 无法为在客户端加载的网站获取 html
问题描述
我无法为客户端 html 加载获取/渲染 html,我尝试使用 HtmlUnit 和 Jsoup,但它们都不起作用。我只得到一个空白的html。
try (final WebClient webClient = new WebClient()) {
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setUseInsecureSSL(true);
HtmlPage page = webClient.getPage(storeUrl);
webClient.waitForBackgroundJavaScript(10000);
System.out.println(page.asXml());
}
我在上面附上了我的代码。
<body>
<div id="app">
</div>
<script type="text/javascript" src="https://appgallery5.huawei.com//static/2021092315/js/manifest.7678f8af2ad1888b12b7.js">
</script>
<script type="text/javascript" src="https://appgallery5.huawei.com//static/2021092315/js/vendor.4515fcb67725b83423f2.js">
</script>
<script type="text/javascript" src="https://appgallery5.huawei.com//static/2021092315/js/app.dffbd1139496dce7c98e.js">
</script>
</body>
</html>
以上是我得到的输出。我在这里做错了什么?
解决方案
推荐阅读
- reactjs - Reactjs Facebook 登录
- django - 在 docker build 中运行“/usr/local/bin/gunicorn”会显示“stat /usr/local/bin/gunicorn:没有这样的文件或目录”
- r - 绘制二进制和连续值的热图
- javascript - 有没有可能使用javascript中的ISOtime格式找到时区的方法
- vue.js - Nuxt 中的服务器端单例注入
- r - 使用 R.Update 时的维数不正确
- sql - SQL 语句的索引
- wordpress - Wordpress:创建图片库时选择图片大小
- java - 通过对 element.getText() 的一次调用从 XPath 结果中排除某些子节点?
- javascript - 从默认路由重定向到另一条路由时的延迟