Upgrade to Pro — share decks privately, control downloads, hide ads and more …

puppeteer

 puppeteer

Google Chrome Puppeteer

Jecelyn Yeen

April 14, 2018
Tweet

More Decks by Jecelyn Yeen

Other Decks in Programming

Transcript

  1. @JecelynYeen From Kuala Lumpur, Malaysia - Google Developer Expert -

    Web technologies, Angular - Software Architect @ Randstad - Organizer - Women Who Code KL
  2. – Someone “If you perform a same task 10 times

    repetitively, consider to automate it.”
  3. Puppeteer - a node library which provide a high level

    API to control headless Chrome or Chromium over the DevTools Protocol.
  4. What can you do with Puppeteer? Most of the things

    you do manually in the browser.
  5. Use cases - Take screenshot - Generate PDF - Scrap

    content - Automate UI testing - Timeline tracing - And more! Can - DDos Attack - Fake page loads - Credential stuffing - *Some page with audio & video Can’t
  6. – Boss “Hey, send me screenshots of mobile, table and

    desktop views of www.competitor.com everyday.”
  7. Work Flow 1. Consultant select a form 2. Send the

    form to candidate (email with url) 3. Candidate fill in the form & submit 4. Queue to process the form A. Generate PDF B. Attach PDF to email and send to candidate
  8. PDF Printing as a service - Express + Puppeteer +

    Cloud Storage - API - POST /pdf/print
  9. Lighthouse - an automated tool for improving the quality of

    web pages. *It uses Puppeteer! https://developers.google.com/web/tools/lighthouse/
  10. Gotchas - Wait for certain page element loaded - Deployment

    - chromium version - Performance overhead