Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Web Browsers»Chrome»How to Capture Screenshot of Webpage Using Google Chrome

    How to Capture Screenshot of Webpage Using Google Chrome

    RahulBy RahulJune 7, 20171 Min ReadUpdated:April 24, 2019

    The Google Chrome 59 and newer versions has included a new feature headless which provides functionality to run Google Chrome without UI. This allows users to use Google Chrome on the command line as well as scripts. This headless Google Chrome version also included the feature to capture a screenshot of any website using command line tool.

    • How to Create PDF of Webpage Using Google Chrome Headless

    Requirements:

    You must be using Google Chrome 59 or later version. With the Google Chrome version 59, it’s only available for MAC OS and Linux users. Windows users still have to wait for some time.

    Capture Screenshot:

    Use the following command to capture a screenshot of the given web page. The output file will be created in the current directory with the name screenshot.png.

    google-chrome --headless --disable-gpu --screenshot http://www.example.com/
    

    You can also specifiy the dimension of screenshot using --window-size option like below.

    google-chrome --headless --disable-gpu --window-size=1280,768 --screenshot http://www.example.com/
    

    You can also specify output filename with location as --screenshot=file1.png to create specific name.

    google-chrome --headless --disable-gpu --print-to-pdf=file1.png http://www.example.com/
    

    Reference:
    https://developers.google.com/web/updates/2017/04/headless-chrome

    chrome google chrome headless chrome
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Extract Zip, Gz, Tar, Bz2, 7z, Xz and Rar File in Linux
    Next Article How to Create PDF of Webpage Using Google Chrome Headless

    Related Posts

    How To Install Google Chrome on Ubuntu 20.04

    Updated:July 4, 20213 Mins Read

    How to Install Google Chrome on Ubuntu 18.04

    Updated:June 8, 20212 Mins Read

    How to Install Chromium Browser on Ubuntu 20.04

    Updated:October 6, 20202 Mins Read

    How to Install Chromium Browser on Ubuntu 18.04

    Updated:September 27, 20202 Mins Read

    How to Setup Selenium with ChromeDriver on Ubuntu 20.04 & 18.04

    Updated:October 5, 20214 Mins Read

    How To Use Google Chrome Headless Features

    Updated:June 9, 20172 Mins Read

    4 Comments

    1. Kenneth Lam on March 4, 2021 3:33 am

      Seems no direct way to capture full screen by just the command line.

      Reply
    2. Ajeet Singh on February 2, 2021 8:54 am

      is it possible to login on some website with username and password than take screenshots ? i am using mac.

      Reply
    3. Peter on July 5, 2019 6:59 pm

      There is a slight mistake in last code piece:

      google-chrome –headless –disable-gpu –print-to-pdf=file1.png http://www.example.com/

      Should be

      google-chrome –headless –disable-gpu –screenshot=file1.png http://www.example.com/

      The –print-to-pdf option will render to PDF

      Reply
    4. npk on February 21, 2019 8:43 am

      Thank you Rahul. Can u pls tell me how to take snap of the entire page?

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.