【问题标题】:Puppeteer waitForTimeout is not a functionPuppeteer waitForTimeout 不是函数
【发布时间】:2021-02-24 13:05:22
【问题描述】:

我在我的最新项目中使用 puppeteer。我使用 NPM (npm i puppeteer) 安装了这个库。从文档中我了解到page.waitFor() 函数现在已被弃用并被page.waitForTimeout() 取代。

当我尝试使用新功能时,我得到UnhandledPromiseRejectionWarning: TypeError: page.waitForTimeout is not a function

可能的原因是什么?我从 NPM 得到的 puppeteer 版本是 2.1.1。

谢谢

【问题讨论】:

  • "我从 NPM 得到的 puppeteer 版本是 2.1.1。" – 最新版本是 5.4.1。使用 2.1.1 版的文档或升级到最新版本。
  • @str 我认为从 NP 安装它会让我获得最新版本。更新方式是什么?谢谢
  • 不一定。试试npm i puppeteer@latest

标签: node.js puppeteer


【解决方案1】:

page.waitForTimeout 已在puppeteer version 5.3.0 中引入。

如 cmets 中所述,您无法在您安装的版本 2.1.1 中使用此新功能。

奖励:Issue #6214 包含有关此主题的更多详细信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-04
    • 1970-01-01
    • 2021-08-23
    • 2022-12-19
    • 2019-05-23
    • 1970-01-01
    相关资源
    最近更新 更多