# How to get a value of an HTML page

**URL:** <https://discourse.nodered.org/t/how-to-get-a-value-of-an-html-page/37975>\
**Category:** General\
**Created:** [24 December 2020 14:14 UTC](https://discourse.nodered.org/t/how-to-get-a-value-of-an-html-page/37975 "2020-12-24T14:14:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)\
**Post date:** [24 December 2020 14:14 UTC](https://discourse.nodered.org/t/how-to-get-a-value-of-an-html-page/37975/1 "2020-12-24T14:14:47Z")

</div>

Hi,

I want to get a VALUE of an element of a (local) HTML page

The element in the HTML page is  
**\<p id="stbStatus"\> VALUE \</p\>**

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/b/fb440898739b4d316ce8962067ca49037f32c82e.png)

I tried a lot of possiblities but I can't figure out what I need to fill in at the Selector field, to get this value?  
Selector value **h1** is working, but that is not the one I need

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 December 2020 14:21 UTC](https://discourse.nodered.org/t/how-to-get-a-value-of-an-html-page/37975/2 "2020-12-24T14:21:13Z")

</div>

You need to know how to use selectors. [Read this](https://community.tealiumiq.com/t5/Extensions/How-to-Determine-the-CSS-Selector-of-an-Element/ta-p/28227#:~:text=Google%20Chrome%20Developer%20Tools,-Finding%20the%20selector&text=To%20find%20the%20CSS%20selector,and%20select%20Copy%20%3E%20Copy%20selector.)

Note: it is possible that the value is dynamically updated by JavaScript after the page loads therefore may not be in the Dom. See how you get on.

---

<div class="post-metadata">

**Author:** ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)\
**Post date:** [24 December 2020 14:54 UTC](https://discourse.nodered.org/t/how-to-get-a-value-of-an-html-page/37975/3 "2020-12-24T14:54:55Z")

</div>

Thanx for the quick answer! Yes it is dynamically updated.

I will have a look

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 December 2020 15:22 UTC](https://discourse.nodered.org/t/how-to-get-a-value-of-an-html-page/37975/4 "2020-12-24T15:22:15Z")

</div>

Read this [recent thread](https://discourse.nodered.org/t/web-scraping-issue/37945) it might be of use for you.

---

<div class="post-metadata">

**Author:** ![gschmidt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gschmidt/32/60349_2.png) [@gschmidt](https://discourse.nodered.org/u/gschmidt)\
**Post date:** [11 January 2021 22:10 UTC](https://discourse.nodered.org/t/how-to-get-a-value-of-an-html-page/37975/6 "2021-01-11T22:10:05Z")

</div>

I figured out that with an HttpRequest node it is not possible to get the value, because it is populated each second by a JavaScript function.

Let me get more specific of what I want to achieve.  
I have a Setopbox (STB) device that I want to communicate with via node-red.  
On Github I have found a simple webinterface of this STB.

> **[basst85/NextRemoteJs](https://github.com/basst85/NextRemoteJs/)**
>
> Simple webinterface for the Ziggo Next setopbox. Contribute to basst85/NextRemoteJs development by creating an account on GitHub.

I have cloned this (and installed the npm requirements) on the same local machine (RPi) as Node-Red.  
I can access the web interface at: [http://192.168.1.51:8080](http://192.168.1.51:8080/)

With an HttpRequest Node I managed to Toggle On/Off, but getting the Status (On, Off, Paused) is not possible with this Node.

But when I check the "index.js" file, I see that communication takes place via an external mqtt server.  
The difficulty is that Username, Password and ClientID for the mqtt server are not static.  
They are generated (each session) from a combination of different " **const**" values.

Which approach would you recommend, with my limited javascript knowledge?

---

<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:** [12 March 2021 22:10 UTC](https://discourse.nodered.org/t/how-to-get-a-value-of-an-html-page/37975/7 "2021-03-12T22:10:15Z")

</div>

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