Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
simply test two selenium servers
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
chdir(__DIR__);
if (!file_exists('vendor/autoload.php')) {
echo 'Please run:' . PHP_EOL;
echo 'composer require facebook/webdriver' . PHP_EOL;
//echo 'composer require dzentota/chrome-dev-tools dev-master' . PHP_EOL;
exit(1);
}
require 'vendor/autoload.php';
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
$driver2 = RemoteWebDriver::create('http://localhost:4444/wd/hub', DesiredCapabilities::firefox());
$driver3 = RemoteWebDriver::create('http://localhost:4445/wd/hub', DesiredCapabilities::firefox());
$driver2->get($_SERVER['argv'][1]);
$driver3->get($_SERVER['argv'][1]);
echo 'Driver #2: ' . $driver2->getTitle() . PHP_EOL;
echo 'Driver #3: ' . $driver3->getTitle() . PHP_EOL;
$driver2->takeScreenshot('test-2.png');
$driver3->takeScreenshot('test-3.png');
# cleanup
$driver2->quit();
$driver3->quit();
unset($driver2, $driver3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment