Puppeteer: delay option passed in page.type method gets overwritten by slowMo option passed to puppeteer.launch method

Created on 14 Nov 2017  路  3Comments  路  Source: puppeteer/puppeteer

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 0.13.0
  • Platform / OS version: macOS Sierra v10.12.6

What steps will reproduce the problem?

The code that reproduces the issue is:

const puppeteer = require('puppeteer');

async function run() {
  const browser = await puppeteer.launch({
    headless: false,
    slowMo: 250
  });
  const page = await browser.newPage();
  page.setViewport({ width: 1280, height: 700 });
  await page.goto('https://www.labs.octasimo.com/puppeteer/test-page-type-delay.html', {
    waitUntil: 'networkidle0'
  });
  await page.type('.firstname', 'Mickey', {delay: 10});
  await page.type('.lastname', 'Mouse', {delay: 10});
  await page.waitFor(5000);
  await browser.close();
}

run();

What is the expected result?

That puppeteer respects the delay option passed in page.type method.

What happens instead?

delay option passed in page.type method gets overwritten by slowMo option passed to puppeteer.launch method.

Most helpful comment

@aslushnikov
I think we should allow individual delays. Browsers run differently on different CPUs, and it's nice to have the ability to slow down certain browser actions to make sure they produce the same results.

All 3 comments

@octasimo, thanks for filing this.

There are no exceptions for the slowMo option: it slows down all interactions between pptr and browser. We'd like to keep it this way to be predictable and to keep codebase simple.

Closing this for now; we can reconsider this later if there's more demand.

@aslushnikov
I think we should allow individual delays. Browsers run differently on different CPUs, and it's nice to have the ability to slow down certain browser actions to make sure they produce the same results.

I think we should allow individual delays. Browsers run differently on different CPUs, and it's nice to have the ability to slow down certain browser actions to make sure they produce the same results.

@sojungko this is polyfillable atop of Puppeteer API: you can use ES6 Proxy to wrap Puppeteer's objects to insert timeouts before or after method calls.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kesava picture kesava  路  3Comments

selfrefactor picture selfrefactor  路  3Comments

bricss picture bricss  路  3Comments

ebidel picture ebidel  路  3Comments

td0m picture td0m  路  3Comments