Sindu_ Sindu_ - 7 months ago 39
HTML Question

Getting text inside a div class in jsoup

I am trying to extract all the text inside the div class "row result". There are many with the same div class name, but different id's. I want to extract all of the text which has the div class as row result. Here is the website link : http://www.indeed.co.uk/jobs?q=fashion&l=England

<div class=" row result" id="p_8f8039e2c2636a2a" data-jk="8f8039e2c2636a2a" itemscope="" itemtype="http://schema.org/JobPosting" data-tn-component="organicJob">


But nothing gets displayed when I run the following code. Please help.

doc = Jsoup.connect("http://www.indeed.co.uk/jobs?q=fashion&l=England").timeout(5000).get();
Elements e = doc.select(".row result");
System.out.println("Details: "+ e.text());

Answer

I think you must write your code like this:

Elements e = doc.select(".row.result");