{"id":13562617,"url":"https://github.com/php-webdriver/php-webdriver","last_synced_at":"2025-09-09T20:21:33.992Z","repository":{"id":38186905,"uuid":"2272514","full_name":"php-webdriver/php-webdriver","owner":"php-webdriver","description":"PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver","archived":false,"fork":false,"pushed_at":"2025-05-09T12:10:08.000Z","size":12822,"stargazers_count":5183,"open_issues_count":24,"forks_count":852,"subscribers_count":166,"default_branch":"main","last_synced_at":"2025-05-13T11:07:15.283Z","etag":null,"topics":["php-webdriver","selenium","selenium-php","selenium-webdriver","w3c-webdriver","webdriver"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-webdriver.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-08-26T05:33:38.000Z","updated_at":"2025-05-13T01:35:19.000Z","dependencies_parsed_at":"2022-06-27T17:32:53.864Z","dependency_job_id":"ecee8578-2067-49c3-90f8-03c22aecfdf5","html_url":"https://github.com/php-webdriver/php-webdriver","commit_stats":{"total_commits":923,"total_committers":114,"mean_commits":8.096491228070175,"dds":0.5178764897074757,"last_synced_commit":"4c18b78d93e4a724ad2dd6427ed658e61a45c569"},"previous_names":["facebook/php-webdriver"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-webdriver%2Fphp-webdriver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-webdriver%2Fphp-webdriver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-webdriver%2Fphp-webdriver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-webdriver%2Fphp-webdriver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-webdriver","download_url":"https://codeload.github.com/php-webdriver/php-webdriver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253929365,"owners_count":21985802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php-webdriver","selenium","selenium-php","selenium-webdriver","w3c-webdriver","webdriver"],"created_at":"2024-08-01T13:01:10.449Z","updated_at":"2025-05-13T11:07:22.635Z","avatar_url":"https://github.com/php-webdriver.png","language":"PHP","readme":"# php-webdriver – Selenium WebDriver bindings for PHP\n\n[![Latest stable version](https://img.shields.io/packagist/v/php-webdriver/webdriver.svg?style=flat-square\u0026label=Packagist)](https://packagist.org/packages/php-webdriver/webdriver)\n[![GitHub Actions build status](https://img.shields.io/github/actions/workflow/status/php-webdriver/php-webdriver/tests.yaml?style=flat-square\u0026label=GitHub%20Actions)](https://github.com/php-webdriver/php-webdriver/actions)\n[![SauceLabs test status](https://img.shields.io/github/actions/workflow/status/php-webdriver/php-webdriver/sauce-labs.yaml?style=flat-square\u0026label=SauceLabs)](https://saucelabs.com/u/php-webdriver)\n[![Total downloads](https://img.shields.io/packagist/dd/php-webdriver/webdriver.svg?style=flat-square\u0026label=Downloads)](https://packagist.org/packages/php-webdriver/webdriver)\n\n## Description\nPhp-webdriver library is PHP language binding for Selenium WebDriver, which allows you to control web browsers from PHP.\n\nThis library is compatible with Selenium server version 2.x, 3.x and 4.x.\n\nThe library supports modern [W3C WebDriver](https://w3c.github.io/webdriver/) protocol, as well\nas legacy [JsonWireProtocol](https://www.selenium.dev/documentation/legacy/json_wire_protocol/).\n\nThe concepts of this library are very similar to the \"official\" Java, JavaScript, .NET, Python and Ruby libraries\nwhich are developed as part of the [Selenium project](https://github.com/SeleniumHQ/selenium/).\n\n## Installation\n\nInstallation is possible using [Composer](https://getcomposer.org/).\n\nIf you don't already use Composer, you can download the `composer.phar` binary:\n\n    curl -sS https://getcomposer.org/installer | php\n\nThen install the library:\n\n    php composer.phar require php-webdriver/webdriver\n\n## Upgrade from version \u003c1.8.0\n\nStarting from version 1.8.0, the project has been renamed from `facebook/php-webdriver` to `php-webdriver/webdriver`.\n\nIn order to receive the new version and future updates, **you need to rename it in your composer.json**:\n\n```diff\n\"require\": {\n-    \"facebook/webdriver\": \"(version you use)\",\n+    \"php-webdriver/webdriver\": \"(version you use)\",\n}\n```\n\nand run `composer update`.\n\n## Getting started\n\n### 1. Start server (aka. remote end)\n\nTo control a browser, you need to start a *remote end* (server), which will listen to the commands sent\nfrom this library and will execute them in the respective browser.\n\nThis could be Selenium standalone server, but for local development, you can send them directly to so-called \"browser driver\" like Chromedriver or Geckodriver.\n\n#### a) Chromedriver\n\n📙 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).\n\nInstall the latest Chrome and [Chromedriver](https://sites.google.com/chromium.org/driver/downloads).\nMake sure to have a compatible version of Chromedriver and Chrome!\n\nRun `chromedriver` binary, you can pass `port` argument, so that it listens on port 4444:\n\n```sh\nchromedriver --port=4444\n```\n\n#### b) Geckodriver\n\n📙 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).\n\nInstall the latest Firefox and [Geckodriver](https://github.com/mozilla/geckodriver/releases).\nMake sure to have a compatible version of Geckodriver and Firefox!\n\nRun `geckodriver` binary (it start to listen on port 4444 by default):\n\n```sh\ngeckodriver\n```\n\n#### c) Selenium standalone server\n\nSelenium server can be useful when you need to execute multiple tests at once,\nwhen you run tests in several different browsers (like on your CI server), or when you need to distribute tests amongst\nseveral machines in grid mode (where one Selenium server acts as a hub, and others connect to it as nodes).\n\nSelenium server then act like a proxy and takes care of distributing commands to the respective nodes.\n\nThe latest version can be found on the [Selenium download page](https://www.selenium.dev/downloads/).\n\n📙 You can find [further Selenium server information](https://github.com/php-webdriver/php-webdriver/wiki/Selenium-server)\nin our wiki.\n\n#### d) Docker\n\nSelenium server could also be started inside Docker container - see [docker-selenium project](https://github.com/SeleniumHQ/docker-selenium).\n\n### 2. Create a Browser Session\n\nWhen creating a browser session, be sure to pass the url of your running server.\n\nFor example:\n\n```php\n// Chromedriver (if started using --port=4444 as above)\n$serverUrl = 'http://localhost:4444';\n// Geckodriver\n$serverUrl = 'http://localhost:4444';\n// selenium-server-standalone-#.jar (version 2.x or 3.x)\n$serverUrl = 'http://localhost:4444/wd/hub';\n// selenium-server-standalone-#.jar (version 4.x)\n$serverUrl = 'http://localhost:4444';\n```\n\nNow you can start browser of your choice:\n\n```php\nuse Facebook\\WebDriver\\Remote\\RemoteWebDriver;\n\n// Chrome\n$driver = RemoteWebDriver::create($serverUrl, DesiredCapabilities::chrome());\n// Firefox\n$driver = RemoteWebDriver::create($serverUrl, DesiredCapabilities::firefox());\n// Microsoft Edge\n$driver = RemoteWebDriver::create($serverUrl, DesiredCapabilities::microsoftEdge());\n```\n\n### 3. Customize Desired Capabilities\n\nDesired capabilities define properties of the browser you are about to start.\n\nThey can be customized:\n\n```php\nuse Facebook\\WebDriver\\Firefox\\FirefoxOptions;\nuse Facebook\\WebDriver\\Remote\\DesiredCapabilities;\n\n$desiredCapabilities = DesiredCapabilities::firefox();\n\n// Disable accepting SSL certificates\n$desiredCapabilities-\u003esetCapability('acceptSslCerts', false);\n\n// Add arguments via FirefoxOptions to start headless firefox\n$firefoxOptions = new FirefoxOptions();\n$firefoxOptions-\u003eaddArguments(['-headless']);\n$desiredCapabilities-\u003esetCapability(FirefoxOptions::CAPABILITY, $firefoxOptions);\n\n$driver = RemoteWebDriver::create($serverUrl, $desiredCapabilities);\n```\n\nCapabilities 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.\n\nTo configure browser-specific capabilities, you may use [📙 ChromeOptions](https://github.com/php-webdriver/php-webdriver/wiki/Chrome#chromeoptions)\nor [📙 FirefoxOptions](https://github.com/php-webdriver/php-webdriver/wiki/Firefox#firefoxoptions).\n\n* 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.\n\n### 4. Control your browser\n\n```php\n// Go to URL\n$driver-\u003eget('https://en.wikipedia.org/wiki/Selenium_(software)');\n\n// Find search element by its id, write 'PHP' inside and submit\n$driver-\u003efindElement(WebDriverBy::id('searchInput')) // find search input element\n    -\u003esendKeys('PHP') // fill the search box\n    -\u003esubmit(); // submit the whole form\n\n// Find element of 'History' item in menu by its css selector\n$historyButton = $driver-\u003efindElement(\n    WebDriverBy::cssSelector('#ca-history a')\n);\n// Read text of the element and print it to output\necho 'About to click to a button with text: ' . $historyButton-\u003egetText();\n\n// Click the element to navigate to revision history page\n$historyButton-\u003eclick();\n\n// Make sure to always call quit() at the end to terminate the browser session\n$driver-\u003equit();\n```\n\nSee [example.php](example.php) for full example scenario.\nVisit our GitHub wiki for [📙 php-webdriver command reference](https://github.com/php-webdriver/php-webdriver/wiki/Example-command-reference) and further examples.\n\n**NOTE:** Above snippets are not intended to be a working example by simply copy-pasting. See [example.php](example.php) for a working example.\n\n## Changelog\nFor latest changes see [CHANGELOG.md](CHANGELOG.md) file.\n\n## More information\n\nSome basic usage example is provided in [example.php](example.php) file.\n\nHow-tos are provided right here in [📙 our GitHub wiki](https://github.com/php-webdriver/php-webdriver/wiki).\n\nIf you don't use IDE, you may use [API documentation of php-webdriver](https://php-webdriver.github.io/php-webdriver/latest/).\n\nYou may also want to check out the Selenium project [docs](https://selenium.dev/documentation/en/) and [wiki](https://github.com/SeleniumHQ/selenium/wiki).\n\n## Testing framework integration\n\nTo take advantage of automatized testing you may want to integrate php-webdriver to your testing framework.\nThere are some projects already providing this:\n\n- [Symfony Panther](https://github.com/symfony/panther) uses php-webdriver and integrates with PHPUnit using `PantherTestCase`\n- [Laravel Dusk](https://laravel.com/docs/dusk) is another project using php-webdriver, could be used for testing via `DuskTestCase`\n- [Steward](https://github.com/lmc-eu/steward) integrates php-webdriver directly to [PHPUnit](https://phpunit.de/), and provides parallelization\n- [Codeception](https://codeception.com/) testing framework provides BDD-layer on top of php-webdriver in its [WebDriver module](https://codeception.com/docs/modules/WebDriver)\n- 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\n\n## Support\n\nWe have a great community willing to help you!\n\n❓ Do you have a **question, idea or some general feedback**? Visit our [Discussions](https://github.com/php-webdriver/php-webdriver/discussions) page.\n(Alternatively, you can [look for many answered questions also on StackOverflow](https://stackoverflow.com/questions/tagged/php+selenium-webdriver)).\n\n🐛 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.\n\n📙 Looking for a **how-to** or **reference documentation**? See [our wiki](https://github.com/php-webdriver/php-webdriver/wiki).\n\n## Contributing ❤️\n\nWe 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.\n\nPhp-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)\nlabel. 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.\n","funding_links":[],"categories":["PHP","Tools"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-webdriver%2Fphp-webdriver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-webdriver%2Fphp-webdriver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-webdriver%2Fphp-webdriver/lists"}