java - Retrieve time tag with Jsoup -


this html:

<div id="trestlelifts">             <header class="tableheader">                 <time>as of 4/23/15 @5:18 mst</time>                 <h2>lifts</h2>             </header> 

i need time tag, cant resolve it.

i try code, app crash

  document docw = jsoup.connect(url).get();   element doc = docw.getelementbyid("header.tableheader");             elements h1=doc.getelementsbytag("time");             string tit = h1.text(); 

element doc = docw.getelementbyid("header.tableheader"); 

doesn't make sense since there no tag id="header.tableheader" attribute.

you want use select instead if want pick <header class="tableheader">.

elements doc = docw.select("header.tableheader"); 

than can pick time tag

elements h1= doc.select("time"); 

based on comment in include address of page want parse seems problem solution <time> empty element <time></time> content generated javascript. in case jsoup not able you, because parser, not js engine. have use different tool selenium webdriver or htmlutils.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -