Screenshot of Dashboard headless mode

Hi guy,
I am trying to take a screenshot in headless mode of the dashboard but till now I had no success.
I can take screenshots of webpages without any problems. but when it comes to taking a screenshot of the dashboard or the node-red program environment I get a white or gray image.
Till now I tried firefox and cutycapt.

In the exec node command line:
firefox -screenshot pic.png http://192.168.1.1:1880/ui

or
xvfb-run --server-args="-screen 0, 1024x768x24" ./CutyCapt --url=http://192.168.1.1:1880/ui --out=pic.png
with cutycapt I tried a delay as well, but same result.

maybe someone of you already solved this problem?!
I would be happy if someone could help me :wink:

Stefan

1 Like

So let me see if I understand. You are running node-red on machine A and it is a headless machine.

You want the NR instance on machine A to take a screen shot of the NR backend running on A

Is that correct?

Hi zenofmud,

Yes that is correct. I am running NR on a raspberry and I want to take a screenshot of the dashboard on this maschine. I can take screenshot from other maschines (html sides, logins from routers,..) in the network, but not from the dashboard itself.

Stefan

How can you take a screenshot if it hasn't got a screen?

On linux you can fire up an X instance without a screen attached. It comes in handy for remote management tools like VNC servers/viewers.

2 Likes

If you want a screen shot why not open the pi’s version of NR on another machine and snap shot it?

Hi zenofmud,
In the end I have only the pi in a network that has NR running. The other network clients are sensors which send data via MQTT to the pi. The pi is in a remote area and the communication will be realized by Telegram. The pi should send a image of the dashboard when I ask for. All works till now except that I can not take a screenshot of the dashboard.

maybe try using npm install node-red-contrib-web-page-screenshot I've never used it, but it might work. If you have issues you should contact the author.

MAKE SURE to read the requirements.

Hi zenofmud,
I have already tested the npm contrib and I had the same problem.
Web pages work fine except the node red.

Best regards,
Stefan

Sorry, I've run out of ideas.

When you say you get a white or grey image do you mean there is nothing there at all node-red related, even on the editor page?

Have you tried chromium rather than firefox? I don't know what OS you're using, but default raspbian doesn't ship with firefox.

Dear JayDickson,

Yes, I tried with puppeteer, that's the headless version of Chromium, but with no useful result.
I am using Buster (Debian) OS.

Did you see my question? I am wondering whether you are seeing the background but not the websockets stuff. Most web pages don't use that which would explain why other pages look ok.
Also does that command work if you run it on a PC picking up the page from the pi.
Just noticed that you have the ip as 192.168.1.1. Are you sure that is the address of the pi, it looks more like a router address? Try http://localhost:1880

Dear Colin,

I am really sorry, totally overlooked your reply!
I have tested different IP addresses and I also tried the http://localhost:1880.
I will make a screenshot of the dashboard and the program environment of NR and put it hear so you can see what the screenshot looks like.
You have a good point, I think the websocket is the problem!

Screenshot with cutycapt of NR progam

Screenshot with cutycapt of dashboard

These are the screenshots taken with firefox

NR program (192.168.1.15:1880)

dashboard (192.168.1.15:1880/ui/)

Does it work if you use those commands in a PC rather than in the pi, but still giving the ip of the pi so it will pick the page up from there. Shut down any browsers first obviously.

It a a dynamic app. Most of the page is built by javascript. If you do a right click view source, then look at the html in there you won’t see much. Unless the grabber you are using behaves like a real browser it may not render the javascript generated parts.

Hey Colin,

I can not test the commands on a PC because I dont have Debian installed on any of my machines.

Hi dceejay,

Any ideas which headless browser could do it?