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

[Bug]: 'page.waitForTimeout' not working in Puppeteer 22.7.1 #12333

Closed
2 tasks
YAnubhavChetan opened this issue Apr 25, 2024 · 2 comments
Closed
2 tasks

[Bug]: 'page.waitForTimeout' not working in Puppeteer 22.7.1 #12333

YAnubhavChetan opened this issue Apr 25, 2024 · 2 comments

Comments

@YAnubhavChetan
Copy link

YAnubhavChetan commented Apr 25, 2024

Minimal, reproducible example

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: "new" }); 
  const page = await browser.newPage();

  try {
    await page.goto('https://www.google.com/');
    console.log('Navigated to Google website.');

    // Wait for 2 seconds using page.waitForTimeout
    await page.waitForTimeout(2000);
    console.log('Waited for 2 seconds using page.waitForTimeout');

  } catch (error) {
    console.error('Error occurred:', error);
  } finally {
    await browser.close();
  }
})();

Error string

Error occurred: TypeError: page.waitForTimeout is not a function

Bug behavior

  • Flaky
  • PDF

Background

I was trying to use waitForTimeout function in my nodejs puppeteer program, but it shows TypeError for the past two days.
I have updated my puppeteer version from 21.9.0 to 22.7.1 before running the program. I run the program several time afterwards but it gets the same TypeError.

So I downgrade my puppeteer version to 21.9.0 and run the program afterwards and this time I don't find any error, which lead me to think that its definitely a bug in this new version.

Then I created this simple puppeteer code to demonstrate the error i am encountering with the latest version.

Expectation

The code working is simple as you can see it yourself.

When run, this code goes to google website and then wait for two seconds and close it.

Reality

But it shows the TypeError on the waitForTimeout function.

Puppeteer configuration file (if used)

No response

Puppeteer version

22.7.1

Node version

20.11.1

Package manager

npm

Package manager version

10.5.2

Operating system

Windows

Copy link

github-actions bot commented Apr 25, 2024

This issue was not reproducible. Please check that your example runs locally and the following:

  • Ensure the script does not rely on dependencies outside of puppeteer and puppeteer-core.
  • Ensure the error string is just the error message.
    • Bad:

      Error: something went wrong
        at Object.<anonymous> (/Users/username/repository/script.js:2:1)
        at Module._compile (node:internal/modules/cjs/loader:1159:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
        at Module.load (node:internal/modules/cjs/loader:1037:32)
        at Module._load (node:internal/modules/cjs/loader:878:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
        at node:internal/main/run_main_module:23:47
    • Good: Error: something went wrong.

  • Ensure your configuration file (if applicable) is valid.
  • If the issue is flaky (does not reproduce all the time), make sure 'Flaky' is checked.
  • If the issue is not expected to error, make sure to write 'no error'.

Once the above checks are satisfied, please edit your issue with the changes and we will
try to reproduce the bug again.


Analyzer run

@YAnubhavChetan YAnubhavChetan changed the title [Bug]: 'page.waitForTimeout' not working in Puppeteer 22.7.0 [Bug]: 'page.waitForTimeout' not working in Puppeteer 22.7.1 Apr 25, 2024
@OrKoN
Copy link
Collaborator

OrKoN commented Apr 25, 2024

waitForTimeout is deprecated and removed in v22 (https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v22.0.0)

@OrKoN OrKoN closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants