# Problems scraping data from web page

**URL:** <https://discourse.nodered.org/t/problems-scraping-data-from-web-page/92445>\
**Category:** General\
**Created:** [16 October 2024 17:17 UTC](https://discourse.nodered.org/t/problems-scraping-data-from-web-page/92445 "2024-10-16T17:17:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco-dmaa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marco-dmaa/32/95560_2.png) [@marco-dmaa](https://discourse.nodered.org/u/marco-dmaa)\
**Post date:** [16 October 2024 17:17 UTC](https://discourse.nodered.org/t/problems-scraping-data-from-web-page/92445/1 "2024-10-16T17:17:43Z")

</div>

Good evening, I have been trying for three days to retrieve data from an HTML page using the HTML node.  
Unfortunately, I am only able to partially extract the data. I would like to understand what I am doing wrong.

This is the html code of the page.

```auto
<body class="stileSito">

    <!-- logo aquatronica -->
    <p align="center"><img border="0" src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/logo.gif" width="350" height="64"></p>

    <!-- titolo della pagina -->
    <p class="titoloPaginaRTM">Real Time Monitor</p>
    <center><p class="styleStatusErrComm" id="_ERR_BUS"></p></center>
    <center><p align="center" id="_PULSANTE_LOGOUT"></p></center>
    <hr>
    <!-- tabella principale -->
    <table border="0" width="100%">
      <tbody>
        <tr>
          <!-- sottotabella per unita' di potenza -->
          <td width="70%" valign="top">
            <b>Power Units</b><br>
            <table border="1" width="100%" bordercolor="#000000" cellspacing="0" cellpadding="2" bordercolorlight="#000000" bordercolordark="#000000">
              <tbody id="_LISTA_PU">
                <tr>
                  <td width="20%" class="intestazionePowerUnit" height="40" xml:space="preserve"> </td>
                  <td width="10%" class="intestazionePowerUnit">A</td>
                  <td width="10%" class="intestazionePowerUnit">B</td>
                  <td width="10%" class="intestazionePowerUnit">C</td>
                  <td width="10%" class="intestazionePowerUnit">D</td>
                  <td width="10%" class="intestazionePowerUnit">E</td>
                  <td width="10%" class="intestazionePowerUnit">F</td>
                  <td width="10%" class="intestazionePowerUnit">G</td>
                  <td width="10%" class="intestazionePowerUnit">H</td>
                </tr>

              <tr><td class="intestazionePowerUnit">Unit� di Potenza</td><td class="cellePlug" align="center" style="border: 6px ridge silver; border-spacing: 1px;"><map title="Plug: CO2 - Status: OFF" indexpu="0" indexplug="0" style="width: 100%; height: 100%;"><img src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/bianco.gif" border="1px" style="border-style: dotted;"></map></td><td class="cellePlug" align="center" style="border: 6px ridge blue; border-spacing: 1px;"><map title="Plug: MODULO ETH - Status: ON - Timer program" indexpu="0" indexplug="1" style="width: 100%; height: 100%;"><img src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/orologio.gif"></map></td><td class="cellePlug" align="center" style="border: 6px ridge silver; border-spacing: 1px;"><map title="Plug: C - Status: OFF" indexpu="0" indexplug="2" style="width: 100%; height: 100%;"><img src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/bianco.gif" border="1px" style="border-style: dotted;"></map></td><td class="cellePlug" align="center" style="border: 6px ridge blue; border-spacing: 1px;"><map title="Plug: WIFI TO ETH - Status: ON - Timer program" indexpu="0" indexplug="3" style="width: 100%; height: 100%;"><img src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/orologio.gif"></map></td><td class="cellePlug" align="center" style="border: 6px ridge silver; border-spacing: 1px;"><map title="Plug: NEON - Status: OFF" indexpu="0" indexplug="4" style="width: 100%; height: 100%;"><img src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/bianco.gif" border="1px" style="border-style: dotted;"></map></td><td class="cellePlug" align="center" style="border: 6px ridge blue; border-spacing: 1px;"><map title="Plug: RISCALDATORE - Status: ON - Temperature sensor program" indexpu="0" indexplug="5" style="width: 100%; height: 100%;"><img src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/temperatura.gif"></map></td><td class="cellePlug" align="center" style="border: 6px ridge blue; border-spacing: 1px;"><map title="Plug: FILTRO - Status: ON - Timer program" indexpu="0" indexplug="6" style="width: 100%; height: 100%;"><img src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/orologio.gif"></map></td><td class="cellePlug" align="center" style="border: 6px ridge silver; border-spacing: 1px;"><map title="Plug: AERATORE - Status: OFF" indexpu="0" indexplug="7" style="width: 100%; height: 100%;"><img src="./Aquatronica System Controller - Ethernet Controller - v. 1.1 - Real Time Monitor_files/bianco.gif" border="1px" style="border-style: dotted;"></map></td></tr></tbody>
            </table>
            <div id="_LEGENDA" class="legenda"></div>
          </td>

          <!-- sottotabella per elenco sensori -->
          <td width="30%" valign="top">
            <b>Sensors</b>
            <table border="0" width="100%" cellpadding="2" class="listaSensori">
              <!-- lista dei sensori -->
              <tbody id="_LISTA_SENSORI"><tr>
                <td class="nomeSensore" style="width: 50%;">Temperatura</td>
                <td class="valoreSensore" style="width: 50%; background-color: red;"> !!! 19.9�C !!! </td></tr>
                <tr><td class="nomeSensore" style="width: 50%;">pH</td>
                  <td class="valoreSensore" style="width: 50%; background-color: aqua;">6.56</td></tr>
              </tbody>
            </table>
          </td>
        </tr>
      </tbody>
    </table>

    <hr>
    <input type="button" class="stylePulsanteComando" name="b" value="Start Real Time Monitor" onclick="startRTMonitor()">
    <input type="button" class="stylePulsanteComando" name="b" value="Stop Real Time Monitor" onclick="stopRTMonitor()">
    <input type="button" class="stylePulsanteComando" name="disImg" id="_YES_NO_IMG" value="No icons">
    <p id="_STATUS_BAR"><div class="styleStatusBar"><span>Real Time Monitor OFF</span></div></p>
    <p>
      </p><center>
        <p class="piePaginaRT">�Copyright 2006 Aquatronica�</p>
        <p class="piePaginaRT"><a href="http://www.aquatronica.it/"><b>www.aquatronica.it</b></a></p>
        <p class="piePaginaRT"><a href="mailto:info@aquatronica.com"><b>info@aquatronica.com</b></a></p>
      </center>
    <p></p>
  <p id="_PROGRESS_BAR">&nbsp;<div class="styleStatusWait"></div></p>
  <div id="_NO_CONNECTION_BAR" style="position:absolute;top:1;left:1">&nbsp;<div class="styleStatusErrComm"></div></div>
  <div id="_EXIT" style="font-size:10;font-weight:bold;position:absolute;top:1;right:10"><a id="_BACK_HOME" href="http://192.168.1.45/index.htm" title="Aquarium Home Page">&lt;&lt; Home Page</a></div>

  <!-- <input type="button" name="bb" value="copy" onclick="var n = document.getElementById('_ORIGINE').cloneNode(true);document.getElementById('_DESTINAZIONE').appendChild(n);"/> -->

  <div id="_NASCOSTO" style="display:none">

```

I,m trying to read this 2 values:

```auto
              <tbody id="_LISTA_SENSORI">
                <tr>
                <td class="nomeSensore" style="width: 50%;">Temperatura</td>
                <td class="valoreSensore" style="width: 50%; background-color: red;"> !!! 19.9�C !!! </td>
                </tr>
                <tr>
                <td class="nomeSensore" style="width: 50%;">pH</td>
                <td class="valoreSensore" style="width: 50%; background-color: aqua;">6.56</td>
                </tr>

```

In my html node i have put this on the selector field:

body\>table\>tbody\>tr\>td\>table.listaSensori\>tbody#\_LISTA\_SENSORI\>tr:nth-child(1)\>td.nomeSensore

B

 ![Cattura](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40fdb68fed1ad2a1a55914b54193021a3e6493ba.png)  
ut it returns me an empty object.

What's wrong??

Thank you all, Marco.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [16 October 2024 18:26 UTC](https://discourse.nodered.org/t/problems-scraping-data-from-web-page/92445/2 "2024-10-16T18:26:55Z")

</div>

> [@marco-dmaa](#):
>
> `_LISTA_SENSORI`

Did you try to use only `#_LISTA_SENSORI` as selector field ?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [16 October 2024 18:30 UTC](https://discourse.nodered.org/t/problems-scraping-data-from-web-page/92445/3 "2024-10-16T18:30:22Z")

</div>

Try selector `td.valoreSensore`  
and select only text of element.

And if you want the names to try `td.valoreSensore , td.nomeSensore`

---

<div class="post-metadata">

**Author:** ![marco-dmaa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marco-dmaa/32/95560_2.png) [@marco-dmaa](https://discourse.nodered.org/u/marco-dmaa)\
**Post date:** [7 December 2024 20:40 UTC](https://discourse.nodered.org/t/problems-scraping-data-from-web-page/92445/4 "2024-12-07T20:40:25Z")

</div>

I resolved finding an xml with all the values..

Thank for your support, Marco.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [21 December 2024 20:40 UTC](https://discourse.nodered.org/t/problems-scraping-data-from-web-page/92445/5 "2024-12-21T20:40:27Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
