Problem with exec node and chrome headless screenshot

Hello

I have run into a problem when trying to use the exec node to take a screen shot of a webpage using Chrome. I did have this working but now it fails. I am using this on a windows 10 machine & Node-red 2.0.5.

If I input the following to the CMD window it works... (I am using google site for testing purposes)


"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --headless --disable-gpu --enable-logging --window-size=1920,5000 --hide-scrollbars --virtual-time-budget=5000 --screenshot="C:\Temp\Test.png" https://www.google.com/

But if i input to an exec node it fails.

I don't know what the issue is? Any help would be appreciated.

Thanks
D

Try setting the exec node like this"

[{"id":"847947e543ced455","type":"exec","z":"21097e2cf5127080","command":"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe ","addpay":"","append":"--headless --disable-gpu --enable-logging --window-size=1920,5000 --hide-scrollbars --virtual-time-budget=5000 --screenshot=\"C:\\Temp\\Test.png\" https://www.google.com/","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":480,"y":140,"wires":[[],[],[]]}]

So the command (and the path to it) goes in the 'Command' ares and the 'options' for the command go in the '+Append' section

1 Like

I've been trying possibilities out to try and help the OP but can't get any to work
Yours gives the GPU errors as well on my Win10 system

What if you put the entire command (minus the double quotes arount the path to the command) along with all the options in an inject nodes msg.payload then leave the exec node command and option blank but check off the "+ Append' so it will use the complete string from msg.payload.

Isn't it more likely to do with the environment the command is running in? A background task rather than a terminal with a window? If it were Linux I would say to try it using ssh and see if it works there.

1 Like

I don’t know since I don’t use windows. Im just offering some small suggestions which are easy enough for someone with windows to try out.

Thankyou all for your replies. I have tried various methods on how the exec command is populated but all result in the same failure.

It is strange because...

1 - This used to work. I had it working a few months back but had not looked closely for a while and when i did look i noticed it had stopped working. In my application i pass the cmd through to the exec via the payload. (what have i changed, nothing other than the node-red rev)

2 - If i copy and past the same command directly into the windows command window. It works , a screenshot is taken and a .png is created and stored in the temp directory. But if i copy and paste into the exec node it fails as shown. Possibly pointing the finger at the exec node or node-red??

here is the command taking screenshot of node-red editor.

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --headless --disable-gpu --enable-logging --window-size=1920,5000 --hide-scrollbars --virtual-time-budget=5000 --screenshot="C:\Temp\Test.png" http://localhost:1880

Thanks
D

What version of node-red were you using? I see you are on v2.0.5. Could you update to the latest and try it.

Thanks for your suggestions. I probably should have updated before posting. But yes , I have now updated and the result is the same. Error.