yanivk1984
1/19/2020 - 1:58 PM

chrome create screenshot from linux command line

# take screenshot from the command line
google-chrome --headless --disable-gpu --no-sandbox --screenshot http://www.example.com/

# specifiy the dimantion
google-chrome --headless --disable-gpu --no-sandbox --window-size=1280,768 --screenshot http://www.example.com/

# choose the name of the png file to export
google-chrome --headless --disable-gpu --no-sandbox --print-to-pdf=file1.png http://www.example.com/

# screenshot from static html file
google-chrome-stable --headless --no-sandbox  --disable-gpu --window-size=1280,768 --screenshot file:///data/backups/7/performance/Memory.html

# screenshot from static file using user defined name
google-chrome-stable --headless --no-sandbox  --disable-gpu --window-size=1280,768 --screenshot=myPNG.png file:///data/backups/7/performance/Memory.html