HTML Node - Problem with CSS selector

Hi@all.

I am a newbie in node-red.I try to scrape a few elements of a website. Therefore i created a selector to define the element i want to read out. When i check my created selector with the chrome devoloper tool the right HTML elements are marked up.

But my flow itself always delivers an "empty" in my debug node. I don't understand, what i am doing wrong.

Thanks in advance

bigmadgaga

The CSS selector:

html>body>div.container>div.content>div.col-md-12.col-sm-12.col-xs-12>div.project_table_wrapper>div.project_table>table>tbody>tr.clickable-row>td.tcol_id

The flow

[{"id":"1b510b24.60b2d5","type":"inject","z":"1723e563.48115b","name":"","props":[{"p":"provider","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":160,"wires":[["c0a51478.248928"]]},{"id":"c0a51478.248928","type":"http request","z":"1723e563.48115b","name":"constaff","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://www.constaff.com/projektangebote/","tls":"","persist":false,"proxy":"","authType":"","x":310,"y":160,"wires":[["50cd306.342e0d"]]},{"id":"4260116f.548ea","type":"debug","z":"1723e563.48115b","name":"","active":true,"tosidebar":false,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":920,"y":160,"wires":[]},{"id":"50cd306.342e0d","type":"switch","z":"1723e563.48115b","name":"check HTTP status","property":"statusCode","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"str"},{"t":"eq","v":"200","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":160,"wires":[["4522eae6.f03f24"],["4a4de365.8de1ec","310a0f48.4fd32"]]},{"id":"b033d97e.4b0eb8","type":"debug","z":"1723e563.48115b","name":"","active":true,"tosidebar":false,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":920,"y":120,"wires":[]},{"id":"4522eae6.f03f24","type":"change","z":"1723e563.48115b","name":"mistake","rules":[{"t":"set","p":"payload","pt":"msg","to":"topit-services HTTP Request fehlerhaft","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":120,"wires":[["b033d97e.4b0eb8"]]},{"id":"4a4de365.8de1ec","type":"change","z":"1723e563.48115b","name":"success","rules":[{"t":"set","p":"payload","pt":"msg","to":"constaff HTTP erfolgreich","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":160,"wires":[["4260116f.548ea"]]},{"id":"35ca9080.58332","type":"debug","z":"1723e563.48115b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":300,"wires":[]},{"id":"310a0f48.4fd32","type":"html","z":"1723e563.48115b","name":"","property":"payload","outproperty":"payload","tag":"#html>body>div.container>div.content>div.col-md-12.col-sm-12.col-xs-12>div.project_table_wrapper>div.project_table>table>tbody>tr.clickable-row>td.tcol_id","ret":"text","as":"single","x":590,"y":220,"wires":[["35ca9080.58332"]]}]

You can use .tcol_id as the selector, you will get an array.

Note for checking the 200, you should use a numeric comparison.

Oooouuuuuuch!!! So easy.

And it works!

@bakman2: Thank you!

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