java - how to extract "value" from a table tag using class name with jsoup -


when try extract value of tag using class name within table tag, this:

<input class="tgndateinput" type="text" name="txtdate" size="10" maxlength="10" value="2015/08/06"> 

using jsoup, how can extract date value ("2015/08/06")?

here code:

system.out.println(table.getelementsbyclass("criteriatext").get(1).getelementsbyattribute("value")); 

actual table on web page:

<table border=0 width=40%> <tr> <td class=criteriatext>date:</td> <td class=criteriatext> <input class=dateinput type=text name=txtdate size=10 maxlength=10 value="2015/08/05">   &nbsp;<span class=textsmall>(yyyy/mm/dd)</span> </td> </tr> </table> 

you should directly using selector:

element txtdateinput = document.select("input[name=txtdate]").first(); string txtdate = txtdateinput.attr("value"); 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -