Puppeteer - 安裝



Puppeteer 的安裝步驟如下:

步驟 1 - 安裝 NodeJS。

有關如何安裝 NodeJs 的詳細資訊在 NodeJS 安裝章節中進行了詳細討論。

步驟 2 - 在某個位置建立一個空資料夾,例如 puppeteer。

步驟 3 - 啟動 Visual Studio Code 應用程式,點選“開啟資料夾”連結,並匯入我們在步驟 2 中建立的資料夾。

Launch the Visual Studio

有關如何安裝 VS Code 的詳細資訊在 VS Code 配置章節中進行了詳細討論。

步驟 4 - 開啟終端,從當前目錄切換到我們在步驟 2 中建立的空資料夾的目錄。然後執行以下命令:

npm

步驟 5 - 對於 Puppeteer 安裝,執行以下命令:

npm install puppeteer

或者,

npm i puppeteer
Puppeteer Installation

步驟 6 - 對於 Puppeteer core 的安裝,執行以下命令:

npm i puppeteer-core

步驟 7 - 在安裝 Puppeteer 和 Puppeteer core 後,我們將在我們在步驟 2 中建立的空資料夾中找到生成的 node_modules 資料夾和 package.json 檔案。

Installation of Puppeteer

步驟 8 - 在進行測試時,我們需要在程式碼中新增以下 Puppeteer 庫。

const pt = require('puppeteer')
廣告

© . All rights reserved.