Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Nov 14, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 14, 2017

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.

@aslushnikov
Copy link
Contributor

@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.

@sojungko
Copy link

@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.

@aslushnikov
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants