1. Go to this page and download the library: Download element-34/php-webdriver library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// This would be the url of the host running the server-standalone.jar
$wd_host = 'http://localhost:4444/wd/hub';
$web_driver = new PHPWebDriver_WebDriver($wd_host);
// First param to session() is the 'browserName' (default = 'firefox')
// Second param is a JSON object of additional 'desiredCapabilities'
// POST /session
$session = $web_driver->session('firefox');
// POST /session/:sessionId/element
$element = $session->element($using, $value);
// POST /session/:sessionId/elements
$session->elements($using, $value);
// POST /session/:sessionId/element/:id/element
$element->element($using, $value);
// POST /session/:sessionId/element/:id/elements
$element->elements($using, $value);
// POST /session/:sessionId/element
$element = $session->element("id", $value);
// POST /session/:sessionId/element
$element = $session->element(PHPWebDriver_WebDriverBy::ID, $value);
$driver = new PHPWebDriver_WebDriver();
$profile = new PHPWebDriver_WebDriverFirefoxProfile('path/to/a/firefox/profile');
$session = $driver->session('firefox', array(), array(), $browser_profile=$profile);
$session->close();
$session->window()->maximize();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.