在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:playwright-community/heroku-playwright-buildpack开源软件地址:https://github.com/playwright-community/heroku-playwright-buildpack开源编程语言:Shell 100.0%开源软件介绍:Heroku Playwright BuildpackThis buildpack installs all the needed dependencies to use Playwright with Chromium and Firefox on Heroku. UsageFor using this buildpack, you have to add the buildpack before installing your Node.js dependencies.
For a full example, see here a usage with the Express library. It's common to use the You should also install the browser specific NPM packages like ExamplesChromiumFor using Chromium, it's necessary to use const { chromium } = require("playwright-chromium");
(async () => {
const browser = await chromium.launch({ chromiumSandbox: false });
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://whatsmyuseragent.org/');
await page.screenshot({ path: `chromium.png` });
await browser.close();
})(); FirefoxFor Firefox, you can refer to the official examples, no need to adjust any configurations. const { firefox } = require("playwright-firefox");
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://whatsmyuseragent.org/');
await page.screenshot({ path: `firefox.png` });
await browser.close();
})(); Best practisesIt's common to only install the browser-specific NPM packages, which will reduce installation time and slug size on Heroku in the end, that should fix also the error that the slug size is too large. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论