0

I want to extract every href atribute from every job offer and then print it in console. And it's partialy working, it's printing url from the elements until the element of list with class results__list-container_item ad-container ad-cointainer--show-mobile. After this element with my println prints empty lines.

website https://www.pracuj.pl/praca/programista;kw/warszawa;wp?rd=30

I used select() from Jsoup:

Document doc = Jsoup.connect(url).get();
Elements offers = doc.select("div.results ul.results__list-container li.results__list-container-item");
for(Element e: offers ){
    String offerUrl = e.select("a.offer__click-area").attr("href");
    System.out.println(offerUrl);
}
Janez Kuhar
  • 3,705
  • 4
  • 22
  • 45
Pawlinho
  • 69
  • 1
  • 7
  • The 5th `li` element contains `a.offer__click-area`, but the 11th `li` element does not. You cannot print anything that does not exist. –  Sep 18 '21 at 12:49
  • @saka1029 The 12th element also have `a.offer__click-area` and so on but rest aren't read. I want to print every element except 11th – Pawlinho Sep 18 '21 at 13:24
  • I can't see inside the 12th `li` element. –  Sep 18 '21 at 13:33
  • @saka1029 Every element have the same build as the one showed in the screen, except the 11th `li` element. But I can change screenshot for you once again – Pawlinho Sep 18 '21 at 13:54
  • 1
    Your question seems to fall into [this](https://stackoverflow.com/questions/7488872/page-content-is-loaded-with-javascript-and-jsoup-doesnt-see-it). –  Sep 18 '21 at 14:53
  • Does this answer your question? [Page content is loaded with JavaScript and Jsoup doesn't see it](https://stackoverflow.com/questions/7488872/page-content-is-loaded-with-javascript-and-jsoup-doesnt-see-it) – Janez Kuhar Sep 21 '21 at 07:08

0 Answers0