<cbn-root> html 元素是什么?以及如何通过 Java 解析它?

What is the <cbn-root> html element? And how to parser it by Java?

我正在尝试编写一个 Java 程序来监控此网站上是否有可用的预留位置:https://www.drpciv.ro/drpciv-booking/formular/23/exchangingForeignDriverLicence

但是当我使用 Chrome 或 Edge 查看页面源代码时,body 部分仅显示 <cbn-root></cbn-root>。但是使用 Chrome 的检查功能我可以看到完整的 body。当我尝试使用 HtmlUnit 获取 Java 中的网页内容时,它只获取 <cbn-root></cbn-root> 而没有实际内容。

尝试google<cbn-root>,但没有看到任何有用的信息。 想知道元素是什么以及在这种情况下如何读取 Java 中的真实内容。

谢谢

尝试 它解释了后端 JS 是异步加载的,您的 GET 请求无法准确获取标签。在这里阅读更多内容。

至少在即将发布的 2.43.0 版本中,标签会被替换。

public static void main(String[] args) throws IOException {
    String url = "https://www.drpciv.ro/drpciv-booking/formular/23/exchangingForeignDriverLicence";

    try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX)) {
        webClient.getOptions().setThrowExceptionOnScriptError(false);

        HtmlPage page = webClient.getPage(url);
        System.out.println(" ---- ");
        webClient.waitForBackgroundJavaScript(10_000);

        System.out.println(" ---- ");
        System.out.println(page.asXml());
    }
}