简体   繁体   English

用jsoup找不到div元素

[英]Can't find div-element with jsoup

I want to extract the red marked Information from this website with jsoup. 我想用jsoup从这个网站中提取红色标记的信息。

网站

The html text of this site is presented by the following picture. 本网站的html文本如下图所示。 The Information i want to extract is red marked again. 我要提取的信息再次被红色标记。

网站的HTML代码

The Problem is that i can't find the div element with the class attribute "found-elements". 问题是我找不到具有类属性“found-elements”的div元素。 My Code looks like this 我的代码看起来像这样

public static void main(String[] args) {
    try {
        Document doc = Jsoup.connect("https://bestmentor.edudip.com/webinar/Lebe-deine-Berufung-und-deine-Arbeit-ist-Liebe/89620").get();           
        Elements ereignisse = doc.select("div#rating-entries div.found-elements article.rating div.text p");
        //Elements ereignisse = doc.select("body div#com-edudip-main-container div#content div.bottom div.academy-sidebar div.box div.ratings-exist div#rating-entries div.found-elements");        

        System.out.println(ereignisse.size());
        // Selektierte Elemente ausgeben ohne HTML-Tags
        for (Element e : ereignisse) {

            System.out.println(e.cssSelector());
            System.out.println(e.text());
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

It would be really kind if somebody could help me. 如果有人可以帮助我,那真是太好了。

Thank you. 谢谢。

Looks like you are targeting content that is loaded via ajax after the page load. 看起来你的目标是在页面加载后通过ajax加载的内容。 Jsoup does not execute script, but as an alternative you could switch to using a headless web browser such as Phantomjs Jsoup不执行脚本,但作为替代方案,您可以切换到使用无头网络浏览器,如Phantomjs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM