如果我的html文档中存在类“电影配置文件”,我会喜欢笑脸
我尝试过输入简单的文字,比如“”但是当我把一个类名放进去时,它仍然给了我:(尽管那个类确实存在。
以下是我目前使用的代码
if(htmlDoc.text().contains("film-profile")) {
System.out.println(":)");
} else {
System.out.println(":(");
}
提前谢谢你!
答案 0 :(得分:1)
尝试:
if(Jsoup.connect("yourURL").get().select(".film-profile").size()!=0){
System.out.println(":)");
} else {
System.out.println(":(");
}