# Problem with exec node and chrome headless screenshot

**URL:** <https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964>\
**Category:** General\
**Created:** [30 October 2021 06:28 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964 "2021-10-30T06:28:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dathor](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dathor](https://discourse.nodered.org/u/dathor)\
**Post date:** [30 October 2021 06:28 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/1 "2021-10-30T06:28:41Z")

</div>

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)

```auto

"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.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/efacc77e09cb8fc8142cf4284957a22281ebc848.png)

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

Thanks  
D

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [30 October 2021 15:18 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/2 "2021-10-30T15:18:14Z")

</div>

Try setting the exec node like this"

```auto
[{"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":[[],[],[]]}]

```

 ![Screen Shot 2021-10-30 at 11.17.14 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/1302d3190bbccefae30a36a51f3a9fc1b6df5a9b.png)

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

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [30 October 2021 15:47 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/3 "2021-10-30T15:47:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [30 October 2021 16:11 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/4 "2021-10-30T16:11:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 October 2021 16:23 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/5 "2021-10-30T16:23:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [30 October 2021 20:53 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/6 "2021-10-30T20:53:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dathor](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dathor](https://discourse.nodered.org/u/dathor)\
**Post date:** [30 October 2021 22:42 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/7 "2021-10-30T22:42:07Z")

</div>

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.

```auto
"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

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [31 October 2021 00:52 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/8 "2021-10-31T00:52:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dathor](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dathor](https://discourse.nodered.org/u/dathor)\
**Post date:** [31 October 2021 01:15 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/9 "2021-10-31T01:15:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 December 2021 01:16 UTC](https://discourse.nodered.org/t/problem-with-exec-node-and-chrome-headless-screenshot/52964/10 "2021-12-30T01:16:57Z")

</div>

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