Ank*_*kit 6 debian-based chromium jenkins puppeteer
我使用 puppeteer 和 lighthouse 开发了一个基于 nodeJS 的项目。我正在使用 puppeteer 登录用户需要登录的任何网站。登录后,我导航到任何页面,例如我的订单、帐户信息、订购页面等。
注意-我把它作为詹金斯上的一个自由风格项目。
详细信息中的确切错误 - 遇到异常:找不到 Chromium(修订版 1095492)。如果出现以下任一情况,就会发生这种情况
npm install)或在调用我的脚本之前尝试运行以下 3 个脚本-->
apt-get 更新
apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango -1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-证书字体解放 libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev
npm 安装-g
npm run MyScriptName
Package.json--> "devDependencies": { "chromedriver": "^108.0.0", "日期和时间": "^2.4.1", "lighthouse": "^9.6.8", "log4js ": "^6.7.1", "傀儡师": "^19.7.1" },
我能够使用下面的代码解决这个问题:
const browserFetcher = puppeteer.createBrowserFetcher();
let revisionInfo = await browserFetcher.download('1095492');
const browser =await puppeteer.launch({
executablePath: revisionInfo.executablePath,
ignoreDefaultArgs: ['--disable-extensions'],
headless: true,
args: ['--no-sandbox', "--disabled-setupid-sandbox"]
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3983 次 |
| 最近记录: |