minkphp / webdriver-classic-driver

Mink driver for the W3C WebDriver Classic protocol
MIT License
3 stars 5 forks source link

Mink WebDriver Classic Driver

Latest Stable Version Latest Unstable Version Total Downloads CI License codecov

Usage Example

<?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.

Installation

composer require behat/mink mink/webdriver-classic-driver

Testing

  1. Start WebDriver
    1. If you have Docker installed, run
      docker run -p 4444:4444 selenium/standalone-firefox:4.18.1
    2. 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
  2. Start WebServer by running
    ./vendor/bin/mink-test-server
  3. Start PhpUnit
    ./vendor/bin/phpunit -v --coverage-clover=coverage.clover