cyrus-and / chrome-remote-interface

Chrome Debugging Protocol interface for Node.js
MIT License
4.22k stars 303 forks source link

blank image generated when taking screenshots #115

Closed anuragphadke closed 7 years ago

anuragphadke commented 7 years ago

Hi, I am trying to take a screenshot using Canary in headless mode on Mac using Node 'v7.9.0'

https://github.com/cyrus-and/chrome-remote-interface/wiki/Take-page-screenshot Running the above script generates an blank 81bytes PNG file. Tried using other websites instead of github.com, same result.

Any idea what might be wrong?

cyrus-and commented 7 years ago

Hi, are you able to try a different version of Chrome, say version 59? Also does this happen in regular (non-headless) mode?

n1313 commented 7 years ago

Same here, Chrome Canary "Version 60.0.3079.0 (Official Build) canary (64-bit)" installed from homebrew, using the screenshot script from the wiki yields a blank 1x1 png in headless mode and doesn't do anything in non-headless (headful?..) mode: I don't see browser reacting to commands. The sample API usage script from readme works fine in both headless and non-headless modes (and I do see browser open github.com in the window).

anuragphadke commented 7 years ago

@cyrus-and : I tried the dev build, returned a blank 81bytes PNG file. Running in regular mode /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --disable-gpu just froze the screenshot script, the screenshot script never exited.

cyrus-and commented 7 years ago

I cannot reproduce on Linux with HeadlessChrome/60.0.3080.0 so it's probably a macOS-specific issue like this one.

cyrus-and commented 7 years ago

OK, I can confirm that it happens for Chrome Canary on macOS.

You should file an issue to the Chromium project. Feel free to link it back here if you do.

cyrus-and commented 7 years ago

Running in regular mode just froze the screenshot script, the screenshot script never exited.

This only happens if there are no open tabs.

anuragphadke commented 7 years ago

Thanks @cyrus-and will use on Linux for now..