How to get value from Website? Need help for scrape-sensor

Hi,
I’m a beginner and trying to integrate some special sensors in my HASS.
There is a value, that is only available by website (no ModBus, etc.)

Here’s an abstract from the website:


<g id="svgConsumptionTooltip" transform="translate(565,190)" class="" style="user-select: none;">
<rect rx="5" ry="5" fill="#F3F3F3" stroke="#0a519c" stroke-width="2" width="105.48599243164062" x="-52.74299621582031" height="34.454694747924805" y="-17.227347373962402"></rect>
<text text-anchor="middle" fill="#0a518c" font-size="10" y="-3.512263298034668">
<tspan x="0">Power consumption</tspan>
<tspan x="0" dy="12">988 W</tspan>
</text>
</g>

I’d like to get the value of power consumption: here seen as 988 W in the last span.
I’ve tried to build a custom sensor

sensor:
  - platform: scrape
    name: varta_consumption
    resource: http://192.168.1.88/index.html
    select: "#svgConsumptionTooltip"
    index: 1

The idea behind is to get a string and later to extract the value by RegEx. But first of all I’d like to get whole string from the website. So I’ve left the regex here for now.

But looking at the entity, the value of this sensor is “unknown”, only.

Do you have any idea, how to simply extract this value?
CU and thanks!

Most of the times you can use the copy selector in Edge.

(two steps below where I have selected)

Thanks, but

select: "#svgConsumptionTooltip > text > tspan:nth-child(2)"

causes an error when restarting.
So I’ve tried

select: "#svgConsumptionTooltip > text > tspan"

But it doesn’t work, even not with index-parameter.
There is still the state “unknown” shown in developer-view.
Do you have any idea?

have the same problem with this site: https://www.netzfrequenzmessung.de/
I used Edge, as @Hellis81 suggested and got the ID.
I would like to scrape the values for Hz but only get “unknown”. Is it maybe changing too fast?

So far my code looks like that:

- platform: scrape
  resource: https://www.netzfrequenzmessung.de/
  name: Netfrequenz
  select: "span#frequenz"
  index: 1

Can anyone help?

I don’t have time to look at it now but a lot of webpages use javascript to populate fields, that won’t work.
You can’t get values that is added using JavaScript