Screenshot from a homepage


Is it possible to take a screenshot from a homepage? I have a list of homepages and want to take a screenshot of each one and the picture should then be saved.


Doesn't anyone have any idea how to do that? You can also save as a PDF if it is not possible as an image.

Have you been through these?

Part of the difficulty is the web page runs outside node-red (on the client/viewers browser) and to get a picture saved back to your node-red server is like letting google or your employer or you ISP take screenshots of what you are browsing - its fraught with danger! Similar to asking a browser to screenshot to file on the client PC is just as dangerous (you can imagine the amount of malware that would be dumped all over your PC by bad actors if that was permitted?)


Thanks for the reply.

No, I am in Europe and it is just 9 p.m.

OK but to read a page as text?

Getting text is (often) easier. Since a browser simply does a HTTP Request to the web server (and gets back the HTML + text etc) you can do the same thing with a HTTP Request node in node-red. However, extracting the correct elements from the response can be tricky.

OK Thanks

I completely forgot, did you have an example?

In the nodered cookbook: Simple GET request : Node-RED

This one should be of help to you.

In case you're still interested in screenshots. I quickly tested node-red-contrib-web-page-screenshot and it seems to work. Tested on an ubuntu machine.

  • had to install chromium-browser package
  • the path to the browser for rendering has to be correct (in my case /usr/bin/chromium-browser)
  • the list with the websites is in the first function node
  • the rendering is quite slow (and the screenshot files are large), maybe there are some more options you can play with and make it faster
[{"id":"2fe6f48.ec2f80c","type":"screenshot","z":"67c61941.053d58","name":"","url":"","path":"/usr/bin/chromium-browser","x":930,"y":160,"wires":[["a37e9457fc9c21a8","479a8cfe337a4e9f"]]},{"id":"479a8cfe337a4e9f","type":"file","z":"67c61941.053d58","name":"","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"base64","x":1150,"y":160,"wires":[[]]},{"id":"a37e9457fc9c21a8","type":"debug","z":"67c61941.053d58","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1150,"y":100,"wires":[]},{"id":"682d9d29fd22a728","type":"inject","z":"67c61941.053d58","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":140,"y":160,"wires":[["8f8fb39a9fdeed89"]]},{"id":"8f8fb39a9fdeed89","type":"function","z":"67c61941.053d58","name":"","func":"msg.payload = [\"\",\"\"];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":160,"wires":[["d21886a98d98f109"]]},{"id":"d21886a98d98f109","type":"split","z":"67c61941.053d58","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":430,"y":160,"wires":[["8eb67b2be99072f8"]]},{"id":"8eb67b2be99072f8","type":"change","z":"67c61941.053d58","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":160,"wires":[["a0681d10f35e142a"]]},{"id":"a0681d10f35e142a","type":"function","z":"67c61941.053d58","name":"","func":"//dirty: assuming urls start with http(s):// \nmsg.filename = msg.url.split(\"://\")[1].replace(\"/\",\"\")+\".png\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":760,"y":160,"wires":[["2fe6f48.ec2f80c"]]}]


Thanks for that. Goes very well. Unfortunately I have the problem that my dashboard no longer works. I get felicitous errors

"RequestError: connect ECONNREFUSED"

What could that be?

Hi @madmax, I am really not sure. Can you provide some more details about your system and when exactly the error occurs?

I have a dashboard where a file is downloaded via the push of a button and is displayed in a table.

When I set up the flow and created the screenshot but unfortunately nothing happens in the dashboard. The file will no longer be downloaded.

The Node Red runs on a MAC.

What happens if you disable the flow taking the screen shot?

it doesn't work there either, but when I restart node red it works again.

  1. what version of NR and node.js? (See startup log)
  2. please export your flow and add it to a reply
  3. what device is NR running on?


I am using the 2.0.1 version.

[{"id":"7ad821b5.a71f7","type":"http request","z":"c07eb5bb.98b6","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","credentials":{},"x":290,"y":140,"wires":[["669889b7.0ceb18"]]}]

And on what device? (Please answer all questions someone - who is trying to help you asks. It saves their time and you could get a quicker answer)


iMac 24 M1

Also the flow does not seem to be complete. Can you check again? It contains only one node.

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