简体   繁体   中英

search element with dynamic ID using java htmlunit

From a web page, I want to search all h3 whose id starts with 'Tomcat_' and ends with '_released'

<h3 id="Tomcat_9.0.19_Released">
  <span class="pull-right">
    2019-04-13
  </span>
   Tomcat 9.0.19 Released
</h3>

first: excample

DomNodeList<DomElement> ss = page.getElementsByTagName("h3");

and later: excample

String value = temp.getAttribute("id");

if(value.startsWith("Tomcat_")&value.endsWith("_released")){
System.out.println(value);
} 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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