A Mink driver powered by Playwright PHP.
Use it to keep an existing Mink test suite while running its browser interactions in Chromium, Firefox, or WebKit through Playwright.
The driver requires PHP 8.2 or later, Mink 1.10 or later, and Playwright PHP 1.x.
composer require --dev playwright-php/playwright-mink
vendor/bin/playwright-install --browsersCreate the driver, pass it to a Mink session, and use the regular Mink API:
<?php
use Behat\Mink\Session;
use Playwright\Mink\Driver\PlaywrightDriver;
$driver = new PlaywrightDriver(
browserType: 'chromium',
headless: true,
);
$session = new Session($driver);
$session->start();
try {
$session->visit('https://example.com');
echo $session->getPage()->getText();
} finally {
$session->stop();
}The constructor accepts:
browserType:chromium,firefox, orwebkit;headless: whether to run without a visible browser window;launchOptions: browser launch options such asslowMoandargs;contextOptions: options passed to the Playwright browser context.
$driver = new PlaywrightDriver(
browserType: 'firefox',
headless: false,
launchOptions: [
'slowMo' => 100,
],
contextOptions: [
'viewport' => ['width' => 1440, 'height' => 900],
'locale' => 'en-US',
],
);See Driver support for the tested Mink surface and known limitations.
The driver is tested against the official
minkphp/driver-testsuite.
Install dependencies, start its test server, then run PHPUnit:
composer install
vendor/bin/playwright-install --browsers
vendor/bin/mink-test-serverIn another terminal:
vendor/bin/phpunitThe test suite currently excludes scenarios that depend on jQuery UI drag and drop or asynchronous popup discovery. These limitations are documented in the driver support page.
Playwright PHP Mink Driver is released under the MIT License.
