PHPackages                             php-webdriver/webdriver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. php-webdriver/webdriver

ActiveLibrary[Testing &amp; Quality](/categories/testing)

php-webdriver/webdriver
=======================

A PHP client for Selenium WebDriver. Previously facebook/webdriver.

1.16.0(4mo ago)5.2k90.0M—3.1%847[19 issues](https://github.com/php-webdriver/php-webdriver/issues)[8 PRs](https://github.com/php-webdriver/php-webdriver/pulls)20MITPHPPHP ^7.3 || ^8.0

Since Sep 10Pushed 3d ago162 watchersCompare

[ Source](https://github.com/php-webdriver/php-webdriver)[ Packagist](https://packagist.org/packages/php-webdriver/webdriver)[ Docs](https://github.com/php-webdriver/php-webdriver)[ RSS](/packages/php-webdriver-webdriver/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (10)Versions (49)Used By (20)

php-webdriver – Selenium WebDriver bindings for PHP
===================================================

[](#php-webdriver--selenium-webdriver-bindings-for-php)

[![Latest stable version](https://camo.githubusercontent.com/15a82ed805255ec526019d5acf0a6d0ade752990a94c49e18019804fbb405ff4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d7765626472697665722f7765626472697665722e7376673f7374796c653d666c61742d737175617265266c6162656c3d5061636b6167697374)](https://packagist.org/packages/php-webdriver/webdriver)[![GitHub Actions build status](https://camo.githubusercontent.com/17b9c329a37c9304a9a83c54799fac196787aabaf4f7aeb97a62aa67b8bdd6f7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d7765626472697665722f7068702d7765626472697665722f74657374732e79616d6c3f7374796c653d666c61742d737175617265266c6162656c3d476974487562253230416374696f6e73)](https://github.com/php-webdriver/php-webdriver/actions)[![SauceLabs test status](https://camo.githubusercontent.com/2e69e96b8a2491140be91df990d4f5be848ffce14c9d598c63766204a3fd2ab5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d7765626472697665722f7068702d7765626472697665722f73617563652d6c6162732e79616d6c3f7374796c653d666c61742d737175617265266c6162656c3d53617563654c616273)](https://saucelabs.com/u/php-webdriver)[![Total downloads](https://camo.githubusercontent.com/2629ee4a6b9f75ec0d3ec1247aacb6cce35c11a6cc8a7c2c6473860cbf957225/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f7068702d7765626472697665722f7765626472697665722e7376673f7374796c653d666c61742d737175617265266c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/php-webdriver/webdriver)

Description
-----------

[](#description)

Php-webdriver library is PHP language binding for Selenium WebDriver, which allows you to control web browsers from PHP.

This library is compatible with Selenium server version 2.x, 3.x and 4.x.

The library supports modern [W3C WebDriver](https://w3c.github.io/webdriver/) protocol, as well as legacy [JsonWireProtocol](https://www.selenium.dev/documentation/legacy/json_wire_protocol/).

The concepts of this library are very similar to the "official" Java, JavaScript, .NET, Python and Ruby libraries which are developed as part of the [Selenium project](https://github.com/SeleniumHQ/selenium/).

Installation
------------

[](#installation)

Installation is possible using [Composer](https://getcomposer.org/).

If you don't already use Composer, you can download the `composer.phar` binary:

```
curl -sS https://getcomposer.org/installer | php

```

Then install the library:

```
php composer.phar require php-webdriver/webdriver

```

Upgrade from version &lt;1.8.0
------------------------------

[](#upgrade-from-version-180)

Starting from version 1.8.0, the project has been renamed from `facebook/php-webdriver` to `php-webdriver/webdriver`.

In order to receive the new version and future updates, **you need to rename it in your composer.json**:

```
"require": {
-    "facebook/webdriver": "(version you use)",
+    "php-webdriver/webdriver": "(version you use)",
}
```

and run `composer update`.

Getting started
---------------

[](#getting-started)

### 1. Start server (aka. remote end)

[](#1-start-server-aka-remote-end)

To control a browser, you need to start a *remote end* (server), which will listen to the commands sent from this library and will execute them in the respective browser.

This could be Selenium standalone server, but for local development, you can send them directly to so-called "browser driver" like Chromedriver or Geckodriver.

#### a) Chromedriver

[](#a-chromedriver)

📙 Below you will find a simple example. Make sure to read our wiki for [more information on Chrome/Chromedriver](https://github.com/php-webdriver/php-webdriver/wiki/Chrome).

Install the latest Chrome and [Chromedriver](https://sites.google.com/chromium.org/driver/downloads). Make sure to have a compatible version of Chromedriver and Chrome!

Run `chromedriver` binary, you can pass `port` argument, so that it listens on port 4444:

```
chromedriver --port=4444
```

#### b) Geckodriver

[](#b-geckodriver)

📙 Below you will find a simple example. Make sure to read our wiki for [more information on Firefox/Geckodriver](https://github.com/php-webdriver/php-webdriver/wiki/Firefox).

Install the latest Firefox and [Geckodriver](https://github.com/mozilla/geckodriver/releases). Make sure to have a compatible version of Geckodriver and Firefox!

Run `geckodriver` binary (it start to listen on port 4444 by default):

```
geckodriver
```

#### c) Selenium standalone server

[](#c-selenium-standalone-server)

Selenium server can be useful when you need to execute multiple tests at once, when you run tests in several different browsers (like on your CI server), or when you need to distribute tests amongst several machines in grid mode (where one Selenium server acts as a hub, and others connect to it as nodes).

Selenium server then act like a proxy and takes care of distributing commands to the respective nodes.

The latest version can be found on the [Selenium download page](https://www.selenium.dev/downloads/).

📙 You can find [further Selenium server information](https://github.com/php-webdriver/php-webdriver/wiki/Selenium-server)in our wiki.

#### d) Docker

[](#d-docker)

Selenium server could also be started inside Docker container - see [docker-selenium project](https://github.com/SeleniumHQ/docker-selenium).

### 2. Create a Browser Session

[](#2-create-a-browser-session)

When creating a browser session, be sure to pass the url of your running server.

For example:

```
// Chromedriver (if started using --port=4444 as above)
$serverUrl = 'http://localhost:4444';
// Geckodriver
$serverUrl = 'http://localhost:4444';
// selenium-server-standalone-#.jar (version 2.x or 3.x)
$serverUrl = 'http://localhost:4444/wd/hub';
// selenium-server-standalone-#.jar (version 4.x)
$serverUrl = 'http://localhost:4444';
```

Now you can start browser of your choice:

```
use Facebook\WebDriver\Remote\RemoteWebDriver;

// Chrome
$driver = RemoteWebDriver::create($serverUrl, DesiredCapabilities::chrome());
// Firefox
$driver = RemoteWebDriver::create($serverUrl, DesiredCapabilities::firefox());
// Microsoft Edge
$driver = RemoteWebDriver::create($serverUrl, DesiredCapabilities::microsoftEdge());
```

### 3. Customize Desired Capabilities

[](#3-customize-desired-capabilities)

Desired capabilities define properties of the browser you are about to start.

They can be customized:

```
use Facebook\WebDriver\Firefox\FirefoxOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;

$desiredCapabilities = DesiredCapabilities::firefox();

// Disable accepting SSL certificates
$desiredCapabilities->setCapability('acceptSslCerts', false);

// Add arguments via FirefoxOptions to start headless firefox
$firefoxOptions = new FirefoxOptions();
$firefoxOptions->addArguments(['-headless']);
$desiredCapabilities->setCapability(FirefoxOptions::CAPABILITY, $firefoxOptions);

$driver = RemoteWebDriver::create($serverUrl, $desiredCapabilities);
```

Capabilities can also be used to [📙 configure a proxy server](https://github.com/php-webdriver/php-webdriver/wiki/HowTo-Work-with-proxy) which the browser should use.

To configure browser-specific capabilities, you may use [📙 ChromeOptions](https://github.com/php-webdriver/php-webdriver/wiki/Chrome#chromeoptions)or [📙 FirefoxOptions](https://github.com/php-webdriver/php-webdriver/wiki/Firefox#firefoxoptions).

- See [legacy JsonWire protocol](https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities) documentation or [W3C WebDriver specification](https://w3c.github.io/webdriver/#capabilities) for more details.

### 4. Control your browser

[](#4-control-your-browser)

```
// Go to URL
$driver->get('https://en.wikipedia.org/wiki/Selenium_(software)');

// Find search element by its id, write 'PHP' inside and submit
$driver->findElement(WebDriverBy::id('searchInput')) // find search input element
    ->sendKeys('PHP') // fill the search box
    ->submit(); // submit the whole form

// Find element of 'History' item in menu by its css selector
$historyButton = $driver->findElement(
    WebDriverBy::cssSelector('#ca-history a')
);
// Read text of the element and print it to output
echo 'About to click to a button with text: ' . $historyButton->getText();

// Click the element to navigate to revision history page
$historyButton->click();

// Make sure to always call quit() at the end to terminate the browser session
$driver->quit();
```

See [example.php](example.php) for full example scenario. Visit our GitHub wiki for [📙 php-webdriver command reference](https://github.com/php-webdriver/php-webdriver/wiki/Example-command-reference) and further examples.

**NOTE:** Above snippets are not intended to be a working example by simply copy-pasting. See [example.php](example.php) for a working example.

Changelog
---------

[](#changelog)

For latest changes see [CHANGELOG.md](CHANGELOG.md) file.

More information
----------------

[](#more-information)

Some basic usage example is provided in [example.php](example.php) file.

How-tos are provided right here in [📙 our GitHub wiki](https://github.com/php-webdriver/php-webdriver/wiki).

If you don't use IDE, you may use [API documentation of php-webdriver](https://php-webdriver.github.io/php-webdriver/latest/).

You may also want to check out the Selenium project [docs](https://selenium.dev/documentation/en/) and [wiki](https://github.com/SeleniumHQ/selenium/wiki).

Testing framework integration
-----------------------------

[](#testing-framework-integration)

To take advantage of automatized testing you may want to integrate php-webdriver to your testing framework. There are some projects already providing this:

- [Symfony Panther](https://github.com/symfony/panther) uses php-webdriver and integrates with PHPUnit using `PantherTestCase`
- [Laravel Dusk](https://laravel.com/docs/dusk) is another project using php-webdriver, could be used for testing via `DuskTestCase`
- [Steward](https://github.com/lmc-eu/steward) integrates php-webdriver directly to [PHPUnit](https://phpunit.de/), and provides parallelization
- [Codeception](https://codeception.com/) testing framework provides BDD-layer on top of php-webdriver in its [WebDriver module](https://codeception.com/docs/modules/WebDriver)
- You can also check out this [blogpost](https://codeception.com/11-12-2013/working-with-phpunit-and-selenium-webdriver.html) + [demo project](https://github.com/DavertMik/php-webdriver-demo), describing simple [PHPUnit](https://phpunit.de/) integration

Support
-------

[](#support)

We have a great community willing to help you!

❓ Do you have a **question, idea or some general feedback**? Visit our [Discussions](https://github.com/php-webdriver/php-webdriver/discussions) page. (Alternatively, you can [look for many answered questions also on StackOverflow](https://stackoverflow.com/questions/tagged/php+selenium-webdriver)).

🐛 Something isn't working, and you want to **report a bug**? [Submit it here](https://github.com/php-webdriver/php-webdriver/issues/new) as a new issue.

📙 Looking for a **how-to** or **reference documentation**? See [our wiki](https://github.com/php-webdriver/php-webdriver/wiki).

Contributing ❤️
---------------

[](#contributing-️)

We love to have your help to make php-webdriver better. See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for more information about contributing and developing php-webdriver.

Php-webdriver is community project - if you want to join the effort with maintaining and developing this library, the best is to look on [issues marked with "help wanted"](https://github.com/php-webdriver/php-webdriver/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)label. Let us know in the issue comments if you want to contribute and if you want any guidance, and we will be delighted to help you to prepare your pull request.

###  Health Score

80

—

ExcellentBetter than 100% of packages

Maintenance88

Actively maintained with recent releases

Popularity84

Widely adopted with strong download metrics

Community56

Growing community involvement

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 67.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~107 days

Recently: every ~263 days

Total

43

Last Release

141d ago

Major Versions

v0.6.0 → 1.0.02015-06-09

PHP version history (8 changes)v0.1PHP &gt;=5.3.0

v0.2PHP &gt;=5.4.0

v0.2.1PHP &gt;=5.4.20

v0.3PHP &gt;=5.3.19

1.2.0PHP ^5.5 || ~7.0

1.5.0PHP ^5.6 || ~7.0

1.9.0PHP ^5.6 || ~7.0 || ^8.0

1.14.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3e1e022cb274083d701b31cb634779f7f4a4e6464fa56a3d0b55f7f4a2487b9?d=identicon)[OndraM](/maintainers/OndraM)

---

Top Contributors

[![OndraM](https://avatars.githubusercontent.com/u/793041?v=4)](https://github.com/OndraM "OndraM (623 commits)")[![whhone](https://avatars.githubusercontent.com/u/1200104?v=4)](https://github.com/whhone "whhone (97 commits)")[![gfosco](https://avatars.githubusercontent.com/u/406732?v=4)](https://github.com/gfosco "gfosco (52 commits)")[![cbergau](https://avatars.githubusercontent.com/u/2446617?v=4)](https://github.com/cbergau "cbergau (21 commits)")[![andrewnicols](https://avatars.githubusercontent.com/u/370047?v=4)](https://github.com/andrewnicols "andrewnicols (17 commits)")[![v-slenter](https://avatars.githubusercontent.com/u/36268710?v=4)](https://github.com/v-slenter "v-slenter (15 commits)")[![dunglas](https://avatars.githubusercontent.com/u/57224?v=4)](https://github.com/dunglas "dunglas (13 commits)")[![williamdes](https://avatars.githubusercontent.com/u/7784660?v=4)](https://github.com/williamdes "williamdes (10 commits)")[![oleg-andreyev](https://avatars.githubusercontent.com/u/1244112?v=4)](https://github.com/oleg-andreyev "oleg-andreyev (9 commits)")[![ashleydw](https://avatars.githubusercontent.com/u/844437?v=4)](https://github.com/ashleydw "ashleydw (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![VolCh](https://avatars.githubusercontent.com/u/396345?v=4)](https://github.com/VolCh "VolCh (5 commits)")[![okrad](https://avatars.githubusercontent.com/u/939812?v=4)](https://github.com/okrad "okrad (4 commits)")[![gkralik](https://avatars.githubusercontent.com/u/4949303?v=4)](https://github.com/gkralik "gkralik (4 commits)")[![phelipealves](https://avatars.githubusercontent.com/u/2778150?v=4)](https://github.com/phelipealves "phelipealves (4 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (4 commits)")[![andrefortin](https://avatars.githubusercontent.com/u/26552025?v=4)](https://github.com/andrefortin "andrefortin (3 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (3 commits)")[![codegain](https://avatars.githubusercontent.com/u/11192306?v=4)](https://github.com/codegain "codegain (3 commits)")[![Lctrs](https://avatars.githubusercontent.com/u/5477973?v=4)](https://github.com/Lctrs "Lctrs (3 commits)")

---

Tags

php-webdriverseleniumselenium-phpselenium-webdriverw3c-webdriverwebdriverphpseleniumwebdriverChromedrivergeckodriver

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/php-webdriver-webdriver/health.svg)

```
[![Health](https://phpackages.com/badges/php-webdriver-webdriver/health.svg)](https://phpackages.com/packages/php-webdriver-webdriver)
```

###  Alternatives

[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[symfony/panther

A browser testing and web scraping library for PHP and Symfony.

3.1k14.7M96](/packages/symfony-panther)[behat/mink-selenium2-driver

Selenium2 (WebDriver) driver for Mink framework

51159.1M666](/packages/behat-mink-selenium2-driver)[lmc/steward

Steward - makes Selenium WebDriver + PHPUnit testing easy and robust

222163.1k1](/packages/lmc-steward)[magium/magium

A browser/functional testing suite using Web Driver. Contains low-ish level functionality to quickly build browser/functional tests.

296.7k10](/packages/magium-magium)[magium/magento

Magento-based functionality for the Magium test library

275.4k2](/packages/magium-magento)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
