2017 © Pedro Peláez
 

library webdriver-manager

Library and command line tool for managing Selenium WebDriver

image

peridot-php/webdriver-manager

Library and command line tool for managing Selenium WebDriver

  • Wednesday, October 4, 2017
  • by brianium
  • Repository
  • 4 Watchers
  • 35 Stars
  • 24,841 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 9 Forks
  • 4 Open issues
  • 7 Versions
  • 1 % Grown

The README.md

WebDriver Manager

Build Status Scrutinizer Code Quality, (*1)

The perfect companion for projects with functional tests. Heavily inspired by the webdriver-manager that ships with protractor. WebDriver Manager allows you to keep Selenium Server binaries up to date. It also provides a packaged solution for easily starting Selenium Server., (*2)

In addition to an easy to use command line application, WebDriver Manager provides a library for managing Selenium binaries in your own apps and tools., (*3)

Installation

WebDriver Manager is meant to be a drop in installation for any project using Selenium WebDriver for functional tests., (*4)

$ composer require --dev peridot-php/webdriver-manager

Once installed, you can operate Selenium Server from the comfort of your project:, (*5)

$ vendor/bin/manager start

Usage

WebDriver Manager Usage, (*6)

clean

Remove all installed binaries., (*7)

WebDriver clean command, (*8)

status

List all available binaries and their installed status. Status shows if the binary is installed, out of date, or missing., (*9)

WebDriver status command, (*10)

update

The update command downloads current binaries and deletes old ones., (*11)

WebDriver update command, (*12)

start

Starts Selnium Server with all drivers managed by WebDriver Manager. The start command will run an update at start to make sure drivers are available and up to date., (*13)

WebDriver start command, (*14)

Library Usage

WebDriver manager exposes a really simple interface that makes it easy to leverage in your own applications and tools:, (*15)

use Peridot\WebDriverManager\Manager;

$manager = new Manager();

$manager->update(); //update all binaries
$manager->update('selenium'); //only update selenium

$manager->clean(); //remove installed binaries

$manager->startInForeground(); //start selenium in the foreground on port 4444
$manager->startInForeground(9999); //start selenium in the foreground on port 9999
$manager->startInBackground(); //start selenium in the background on port 4444
$manager->startInBackground(9999); //start in the background on port 9999 

$path = $manager->getInstallPath(); //where binaries are installed
$manager->setInstallPath(__DIR__); //set the path to install binaries

$manager->addBinary(new MyCustomDriver()); //add a binary to manage
$manager->removeBinary('chromdedriver'); //remove a managed binary
$binaries = $manager->getBinaries(); //get a collection of managed binaries

A note on starting Selenium in the background

WebDriver Manager does not block when starting a background process. This makes it difficult to see if Selenium encountered any errors (perhaps a corrupt binary?). The SeleniumProcess class provides a method for checking the status of the process. If you want to check that Selenium Server started in the background ok, you might try something like this:, (*16)

$process = $manager->startInBackground();
usleep(250000); //give Selenium a quarter of a second to validate input
if (! $process->isRunning()) {
    //Selenium encountered an error
    print $process->getError();
    $process->close();
    return;
}

//do rad Selenium things

For more information, see the API docs;, (*17)

Examples

The API has been used to create a custom Behat listener capable of starting the server before Mink tests are run. This tool is included as part of a demo project known as behavior driven todos., (*18)

Running Tests

WebDriver Manager's tests were written using the Peridot test framework., (*19)

Unit tests can be run like so:, (*20)

$ vendor/bin/peridot

And integration tests can be run like this:, (*21)

$ vendor/bin/peridot --grep *.it.php

Contributing

Please feel free to open issues or pull requests., (*22)

The Versions

04/10 2017

dev-master

9999999-dev

Library and command line tool for managing Selenium WebDriver

  Sources   Download

MIT

The Requires

 

The Development Requires

testing selenium webdriver

19/10 2016

1.3.1

1.3.1.0

Library and command line tool for managing Selenium WebDriver

  Sources   Download

MIT

The Requires

 

The Development Requires

testing selenium webdriver

26/06 2015

1.3.0

1.3.0.0

Library and command line tool for managing Selenium WebDriver

  Sources   Download

MIT

The Requires

 

The Development Requires

testing selenium webdriver

28/03 2015

1.2.0

1.2.0.0

Library and command line tool for managing Selenium WebDriver

  Sources   Download

MIT

The Requires

 

The Development Requires

testing selenium webdriver

17/03 2015

1.1.1

1.1.1.0

Library and command line tool for managing Selenium WebDriver

  Sources   Download

MIT

The Requires

 

The Development Requires

17/03 2015

1.1.0

1.1.0.0

Library and command line tool for managing Selenium WebDriver

  Sources   Download

MIT

The Requires

 

The Development Requires

17/03 2015

1.0.0

1.0.0.0

Library and command line tool for managing Selenium WebDriver

  Sources   Download

MIT

The Requires

 

The Development Requires