Code Monkey home page Code Monkey logo

bkd-puppeteer's Introduction

Puppeteer: CLI based Website Screenshots

This is a straight forward Puppeteer based website screenshot generator.


How it works

We use Puppeteer to identify and capture any given website's primary navigation links (urls): nav > ul > li > a.

For every qualified navigation item, we capture and add the title and href values into an array. Then we simply iterate through that array, use Puppeteer's goto method to capture both default viewport and full-page screenshots.


Installation & Configuration

  • npm i bkd-puppeteer

  • Create an .env file in the root of the project's directory

    • Add baseline variables as shown below

    (If the site has simple authentication, provide a username and password):

    HOST=https://npr.com
    USER=yourUserName
    PASS=yourPassword
    DESTINATION=build-directory-of-choice
    

Where screenshots are published

  • Screenshots are generated into the directory you've indicated in .env
  • Filenames follow this format: Page name - Device name - Height - width.jpg
    • Realworld example: Contact-Us-iPad-768x1024.fullscreen.jpg

Available Scripts

  • npm run puppet
  • npm run puppet-dev - only difference is the use of nodemon

That's pretty much it. I know. Nothing Earth shattering but clients find it useful because it's a real time-saver in UI Regression Testing.

Hopefully someone out there will find this helpful. I'm going to continue to extend this (mostly for my own personal development).

If anyone has suggestions...feel free to throw ideas out there :)

created by BKD Digital Inc.

bkd-puppeteer's People

Contributors

beknowdo avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.