是否可以使用 CodeceptJS + PlayWright 或 CodeceptJS + Puppeteer 启动 Chrome 浏览器

问题描述

我可以使用 Playwright-core 和 puppeteer-core 启动 Chrome 浏览器,但想在 Playwright 中使用 codeceptjs。

我们可以使用 CodeceptJS 使用 Playwright-core 或 puppeteer-core 吗?

解决方法

已提供无需下载 Chromium 二进制文件即可安装 puppeteer 的解决方案 in this issue post

npm config set puppeteer_skip_chromium_download true
npm install puppeteer

in their documentation所述的剧作家存在相同类型的环境变量:

PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright

之后你可以像往常一样安装和配置 CodeceptJS:

npm install codeceptjs
npx codeceptjs init

请注意,还有 an open issue in the CodeceptJS repository about supporting explicitely playwright-core 包,因此没有直接安装该包的官方方法。