<?php
use Behat\Mink\Mink,
Behat\Mink\Session,
Mink\WebdriverClassicDriver\WebdriverClassicDriver;
require_once __DIR__ . '/vendor/autoload.php';
$browserName = 'firefox';
$url = 'http://example.com';
$mink = new Mink(array(
'webdriver-classic' => new Session(new WebdriverClassicDriver($browserName)),
));
$session = $mink->getSession('webdriver-classic');
$session->visit($url);
$session->getPage()->findLink('Chat')->click();
Please refer to MinkExtension-example for an executable example.
composer require behat/mink mink/webdriver-classic-driver
- Start WebDriver
- If you have Docker installed, run
docker run -p 4444:4444 selenium/standalone-firefox:4.18.1
- If you do not have Docker, but you have Java
curl -L https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.18.0/selenium-server-4.18.1.jar > selenium-server-4.18.1.jar java -jar selenium-server-4.18.1.jar standalone
- Start WebServer by running
./vendor/bin/mink-test-server
- Start PhpUnit
./vendor/bin/phpunit -v --coverage-clover=coverage.clover