0

当尝试运行此 url 页面时,这是我不断收到的错误。请指教。

(node:2136) UnhandledPromiseRejectionWarning: TypeError: browser.newpage is not a function
    at createPage (C:\Users\xolas\Downloads\Bot development\bot.js:7:32)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2136) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing 
inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2136) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

const puppeteer = require('puppeteer');

const product_url = "https://www.wilko.com/";

async function createPage() {
  const browser = await puppeteer.launch({
    headless: false
  });
  const page = await browser.newPage();

  await page.goto(product_url);
}

createPage()

4

0 回答 0