Jsoup select div having multiple classes

Works for me with latest Jsoup (1.5.2).

String html = "<div class=\"content-text right-align bold-font\">foo</div>";
Document document = Jsoup.parse(html);
Elements elements = document.select("div.content-text.right-align.bold-font");
System.out.println(elements.text()); // foo

So either you’re possibly using an outdated version of Jsoup which exposes a bug related to this, or the actual HTML doesn’t contain a <div> like that.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)