Skip to content

Setup Playwright PHP

Actions
Install the Playwright JS library and download the browsers you need (default: chrome). Made for PlaywrightPHP
v1.0.0
Latest
Star (2)
Playwright PHP

  CI   Release   License

Setup Playwright (for PHP)

Sets up the runner for Playwright for PHP:

  • install Playwright library globally
  • download the browser binaries (default: Chrome)

Usage

# .github/workflows/test.yml
name: PHP Tests
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: playwright-php/setup-playwright@v1
        with:
          browsers: chrome      # default value
          
      - uses: shivammathur/setup-php@v2
        with:
          php-version: '8.4'
      - run: composer install
      - run: vendor/bin/phpunit

Examples

Install multiple browsers

- uses: playwright-php/setup-playwright@v1
  with:
    browsers: '["chromium","firefox"]'

Reuse cached browser downloads

- uses: actions/cache@v4
  with:
    path: ~/.cache/ms-playwright
    key: browsers-${{ runner.os }}

- uses: playwright-php/setup-playwright@v1
  with:
    browsers-path: ~/.cache/ms-playwright

Pin the Playwright CLI version and skip deps

- uses: playwright-php/setup-playwright@v1
  with:
    playwright-version: '1.48.2'
    browsers: webkit
    with-deps: false

Outputs

The action exposes two outputs:

  • playwright-version: the installed Playwright CLI version
  • installed-browsers: a JSON list of the browsers that were installed

Configuration

Option Default Allowed values Notes
browsers chrome chrome, chromium, firefox, webkit, msedge, all msedge only on Windows runners
playwright-version latest Any valid npm specifier (for the playwright package) Leave latest to track upstream.
with-deps auto true, false, auto auto appends Playwright's --with-deps flag on Linux runners.
browsers-path Directory path Exports PLAYWRIGHT_BROWSERS_PATH so downloads land in your cache. Leave blank for Playwright defaults (~/.cache/ms-playwright, %LOCALAPPDATA%\ms-playwright, etc.)

Testing the action

  1. Trigger .github/workflows/test.yml via workflow_dispatch to exercise the action on hosted runners.
  2. Run the same workflow with act to catch issues locally before pushing.
  3. In a scratch repo, reference the action with uses: ./ so every commit is validated before tagging a Marketplace release.

License

This package is released by the Playwright PHP project under the MIT License. See the LICENSE file for details.

Setup Playwright PHP is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Install the Playwright JS library and download the browsers you need (default: chrome). Made for PlaywrightPHP
v1.0.0
Latest

Setup Playwright PHP is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.