Open morawcik opened 2 years ago
Hi.
I'm trying read some information from page where is this table:
<table class="odds-table"> <thead> <tr> <th class="quality"> Wear </th> <th class="price"> Price </th> <th class="odds-number"> Odds </th> </tr> </thead> <tbody> <tr> <td class="quality"> BS </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>21.34</span></span> </td> <td class="odds-number"> 0.0833% </td> </tr> <tr> <td class="quality"> WW </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>23.92</span></span> </td> <td class="odds-number"> 0.0743% </td> </tr> <tr> <td class="quality"> FT </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>30.15</span></span> </td> <td class="odds-number"> 0.0588% </td> </tr> <tr> <td class="quality"> MW </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>44.03</span></span> </td> <td class="odds-number"> 0.0403% </td> </tr> <tr class="stattrak"> <td class="quality"> BS </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>54.22</span></span> </td> <td class="odds-number"> 0.0328% </td> </tr> <tr class="stattrak"> <td class="quality"> WW </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>61.56</span></span> </td> <td class="odds-number"> 0.0288% </td> </tr> <tr class="stattrak"> <td class="quality"> FT </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>86.63</span></span> </td> <td class="odds-number"> 0.0205% </td> </tr> <tr> <td class="quality"> FN </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>92.65</span></span> </td> <td class="odds-number"> 0.0191% </td> </tr> <tr class="stattrak"> <td class="quality"> MW </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>127.99</span></span> </td> <td class="odds-number"> 0.0139% </td> </tr> <tr class="stattrak"> <td class="quality"> FN </td> <td class="price"> <span class="is-align-content-center is-inline-flex is-justify-content-center price" data-v-599129ef><i class="core-icon core-usd-new" data-v-599129ef></i> <span data-v-599129ef>351.72</span></span> </td> <td class="odds-number"> 0.005% </td> </tr> </tbody> </table>
Then i have my code (after loading page and waiting for element):
$data = $node->filter('.odds-table tbody tr')->each(function (Crawler $node, $i) { return [ 'exterior' => $node->filter('.quality')->text(), 'percentage' => $node->filter('.odds-number')->text(), 'is_st' => $node->attr('class') == 'stattrak' ]; });
but it reads only the class attribute from tr nodes. Also i tried debugging myself i went up in this structure (tr, tbody, table..) and read text() or html() but it always is empty. Tested on Chrome and Firefox drivers. What i'm doing wrong?
Hi.
I'm trying read some information from page where is this table:
Then i have my code (after loading page and waiting for element):
but it reads only the class attribute from tr nodes. Also i tried debugging myself i went up in this structure (tr, tbody, table..) and read text() or html() but it always is empty. Tested on Chrome and Firefox drivers. What i'm doing wrong?