Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ You should also install the browser specific NPM packages like `playwright-chrom

### Chromium

For using Chromium, it's **necessary** to use `chromiumSandbox: false` in the launch options, since on Heroku is no support for the Chromium sandbox.
For Chromium, you can refer to the official examples.

```javascript
const { chromium } = require("playwright-chromium");

(async () => {
const browser = await chromium.launch({ chromiumSandbox: false });
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://whatsmyuseragent.org/');
Expand All @@ -39,7 +39,7 @@ const { chromium } = require("playwright-chromium");

### Firefox

For Firefox, you can refer to the official examples, no need to adjust any configurations.
For Firefox, you can refer to the official examples.

```javascript
const { firefox } = require("playwright-firefox");
Expand Down
70 changes: 20 additions & 50 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -28,66 +28,36 @@ install_system_deps() {

SUPPORTED_BROWSERS=${PLAYWRIGHT_BUILDPACK_BROWSERS:-chromium,firefox,webkit}
echo "Installing Playwright dependencies (env: PLAYWRIGHT_BUILDPACK_BROWSERS) for $SUPPORTED_BROWSERS."

if [[ "$SUPPORTED_BROWSERS" == *"chromium"* ]]; then

cat << EOF >>$build_tmpdir/Aptfile
# Chromium dependencies
libnss3
libxss1
libasound2
fonts-noto-color-emoji
libgbm1
libatk-bridge2.0-0
libxkbcommon0
libxrandr2
libatspi2.0-0
libxshmfence-dev
EOF
fi

if [[ "$SUPPORTED_BROWSERS" == *"firefox"* ]]; then
cat << EOF >>$build_tmpdir/Aptfile
# Firefox dependencies
libdbus-glib-1-2
libxt6
libsm6
libice6
libx11-xcb1
libxcursor1
libxi6
EOF
fi

if [[ "$SUPPORTED_BROWSERS" == *"firefox"* || "$SUPPORTED_BROWSERS" == *"chromium"* ]]; then
cat << EOF >>$build_tmpdir/Aptfile
# Needed by Firefox and Chromium
libgdk-pixbuf2.0-0
libcairo-gobject2
libpulse0
libusb-1.0-0
libatk1.0-0
libatspi2.0-0
libcairo2
libcups2
libdbus-1-3
libdrm2
libgbm1
libglib2.0-0
libnspr4
libnss3
libpango-1.0-0
libx11-6
libxcb1
libxcomposite1
libxdamage1
libxext6
libxfixes3
libgtk-3-0
libxkbcommon0
libxrandr2
libxshmfence1
xvfb
fonts-noto-color-emoji
ttf-unifont
EOF
fi

case "$STACK" in
"heroku-18")
cat << EOF >>$build_tmpdir/Aptfile
libvpx5
EOF
;;
"heroku-20")
cat << EOF >>$build_tmpdir/Aptfile
libvpx6
EOF
;;
*)
error "STACK must be 'heroku-18' or 'heroku-20'"
esac

local cache_tmpdir=$(mktemp -d)

HOME=/app $buildpack_tmpdir/bin/compile $build_tmpdir $cache_tmpdir
Expand Down