Как напечатать <th>и <td>из <tr>рядом в Java с помощью Jsoup? - PullRequest
0 голосов
/ 09 мая 2020

Вот html код с сайта:

<table class="product-specs">
    <tbody>

       <tr data-specid="8751">
            <th>Touch Bar</th>
            <td>Ne</td>
       </tr>

       <tr data-specid="62">
            <th>RAM memorija</th>
            <td>16GB</td>
       </tr>

Вот мой Java код:

Document doc = Jsoup.connect("https://www.gigatron.rs/laptop_racunari/hp_pavilion_gaming__15ec0024nm__8pk23ea-299138").get();
System.out.println("ok");
Elements specName = doc.select(".product-specs tbody tr th");
Elements specHave = doc.select(".product-specs tbody tr td");
            System.out.println(specName.html() + " " + specHave.html());

Он просто печатает specName сначала и под ним specHave. Можно мне как распечатать рядом?

...