标签: java htmlunit htmlunit-driver
我想从网页中搜索所有ID为'Tomcat_'到'_released'结尾的h3
'Tomcat_'
'_released'
<h3 id="Tomcat_9.0.19_Released"> <span class="pull-right"> 2019-04-13 </span> Tomcat 9.0.19 Released </h3>
答案 0 :(得分:0)
第一: excample
DomNodeList<DomElement> ss = page.getElementsByTagName("h3");
及更高版本: excample
String value = temp.getAttribute("id"); if(value.startsWith("Tomcat_")&value.endsWith("_released")){ System.out.println(value); }