PHP code example of peridot-php / webdriver-manager

1. Go to this page and download the library: Download peridot-php/webdriver-manager 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/ */

    

peridot-php / webdriver-manager example snippets


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

$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

$ composer