Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Web Browsers»Chrome»How to Capture Screenshot of Webpage Using Google Chrome

    How to Capture Screenshot of Webpage Using Google Chrome

    By RahulSeptember 16, 20221 Min Read

    The Google Chrome 59 and newer versions have 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 the command line tool.

    Advertisement
    • How to Create PDF of Webpage Using Google Chrome Headless

    Requirements:

    You must be using Google Chrome 59 or a later version. With 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

    Related Posts

    Installing Google Chrome on Pop!_OS

    How to Install Google Chrome in Pop!_OS

    How to View HTTP Headers in Google Chrome

    Download Google Chrome on MacOS

    How To Install Google Chrome On macOS

    View 4 Comments

    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

    Advertisement
    Recent Posts
    • tail Command in Linux with Examples
    • What is a Orphan Process in Unix/Linux
    • How To Display Warning Message to Unauthorized SSH Access
    • How to Set a Custom SSH Login Banner and MOTD
    • Understanding Reverse DNS: What it is and Why it Matters?
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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