php-webdriver/webdriver
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
symfony/process | v3.4.47 | - | MIT | prod |
The php-webdriver/webdriver is a 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, supporting both modern W3C WebDriver protocol and the legacy JsonWireProtocol.
To leverage the power of php-webdriver/webdriver, you first need to install it using Composer. If you don't already have Composer, you can download the binary with curl -sS https://getcomposer.org/installer | php
, and then install the library using php composer.phar require php-webdriver/webdriver
. This package was previously named facebook/php-webdriver
. If upgrading from a version prior to 1.8.0, you need to change the name in your composer.json and run composer update
.
Here is a simple usage example:
// Create a Browser Session
// After starting the server (check readme for instructions), specify its URL
$serverUrl = 'http://localhost:4444'; // Change this according to your setup
// Initiate your driver using the server's URL and browser's desired capabilities
use Facebook\WebDriver\Remote\RemoteWebDriver;
$driver = RemoteWebDriver::create($serverUrl, DesiredCapabilities::chrome());
// Control your browser
// Navigate to a webpage
$driver->get('https://www.example.com');
// Perform operations (find elements, fill forms, click buttons, etc.)
$driver->findElement(WebDriverBy::id('searchInput'))->sendKeys('PHP')->submit();
// Always remember to quit the driver at the end
$driver->quit();
Remember, these snippets aren't intended to be a fully working example by simply copy-pasting. Adjust them according to your specific needs.
Comprehensive php-webdriver/webdriver documentation is available directly on their GitHub repository. You can consult the library's wiki for complete instructions on using the library with useful examples and how-tos. If you don't use an IDE, you can refer to the php-webdriver API documentation for an in-depth look at the API. Also, detailed guides on Selenium server setups and browser drivers can be found in the wiki.