Ke10 Ke10 - 4 months ago 8
Java Question

Java jsoup how to see if a class is in the html

The class is

class="error_ctn"
is it possible too see if this is in the html of the site? I've sifted through some of the documentation but couldn't find anything.

Answer

You can select elements by ID and check the length of the array you receive

if(doc.getElementsByClass("error_ctn").size() == 0){
    //element with that class is not in HTML
}