Thursday 15 May 2014

html - How to find div inside another div using HtmlUnit? -


I am working on some projects where I need to scrap some information from different websites. I HtmlUnit for this purpose, but the problem I am unable to cross through the elements on a page.

Example:

  & lt; Div id = "some_id" & gt; & Lt; Div & gt; & Lt; Div & gt; & Lt; Div & gt; In between ...... many divs ...... and lt; Div id = "my_target_div" & gt; Some information & lt; / Div & gt; ........ ........ & lt; / Div & gt;   

Now with div id my_target_div and that div < / Div>

getHtmlElementById .

.

An example:

  @Test Public Zero Receipts () Exceptions thrown {last webclient webClient = new WebClient (); Last HTML page page = webClient.getPage ("http: // some_url"); Ultimate HTML Division DIV = Page.Gate HTML Element BIID ("my_target_div"); WebClient.closeAllWindows (); }   



No comments:

Post a Comment