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

Introduction to Puppeteer

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
Tam Mullen
August 29, 2018

Introduction to Puppeteer

Introduction to using Puppeteer in conjunction with Dev Tools such as Coverage tool.

Tam Mullen

August 29, 2018

Transcript

23 slides
  1. “

  2. CDP

  3. “

  4. let loginPage = new Login(page); await loginPage.enterUsername(); await loginPage.enterPassword(); constructor(page)

    { this.page = page; this.username = '#usernameOrEmail'; this.usernameSubmit = '#wp-submit, button[type="submit"]'; this.password = '#password'; this.loginSubmit = '#wp-submit, button[type="submit"]'; this.readerHome = '.following.main'; this.mySitesLink = '[data-tip-target=my-sites]'; } async enterUsername() { await this.page.type(this.username, config.testUserName); await this.page.click(this.usernameSubmit); } async enterPassword() { await this.page.waitForSelector(this.password, { visible: true }); await this.page.type(this.password, config.testPassword); }
  5. $ npm run start -- -v Clearing previous traces... Starting

    browser... Logging in... Starting measurements for section reader... Timing initial visit to new-post... Initial time: 187.634ms Timing repeat visits to new-post... Mean time: 1336.41ms Timing initial visit to likes... Initial time: 654.691ms Timing repeat visits to likes... Mean time: 687.038ms Timing initial visit to search...

Other Decks in Technology