PHP code example of shimabox / selenium-downloader
1. Go to this page and download the library: Download shimabox/selenium-downloader 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/ */
shimabox / selenium-downloader example snippets
SMB\SeleniumDownloader\Downloader;
// Interface
use SMB\SeleniumDownloader\Argument\Optionable;
// Prepare a class that implements the optionable interface.
class InstantSelenium implements Optionable
{
/**
* Returns true if option is specified.
*
* @return boolean
*/
public function isSpecified()
{
return true;
}
/**
* If true it will output a help message.
*
* @return boolean
*/
public function isSpecifiedHelp()
{
return false;
}
/**
* Create help message.
*
* @return string
*/
public function createHelpMessage()
{
return '';
}
/**
* Get optional arguments.
*
* e.g)
* <code>
* return [
* 'p' => 'w', // Select platform [m]ac or [w]indows or [l]inux.
* 'd' => '.', // Enter the output directory path.
* 's' => '3.8.1', // Enter the version of selenium-standalone-server. (e.g 3.8.1, 3.7(3.7.0)
* 'c' => '81.0.4044.69', // Enter the version of ChromeDriver. (e.g 81.0.4044.69, 2.43
* 'g' => '0.26.0', // Enter the version of GeckoDriver. (e.g 0.26(0.26.0), 0.20.1
* 'i' => '3.141.59', // Enter the version of IEDriverServer. (e.g 3.141.59, 3.14(3.14.0)
* 'b' => '32', // Enter the number of OS bits (32 or 64).
* ];
* </code>
*
* @return array
*/
public function get()
{
return [
'p' => 'm', // Select mac.
's' => '3.8.1',
'c' => '81.0.4044.69',
'g' => '0.26.0',
];
}
}
$downloader = new Downloader(new InstantSelenium());
$downloader->execute();
# Run without option.
$ php selenium_downloader.php
$ php instant_selenium.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.