What are you trying to achieve? (Expected behavior)
running example.php
What do you get instead? (Actual behavior)
feb2018@adminxA MINGW32 /d/xampp/htdocs/php-webdriver
$ git clone https://github.com/facebook/php-webdriver.git
Cloning into 'php-webdriver'...
remote: Counting objects: 6557, done.
remote: Total 6557 (delta 0), reused 0 (delta 0), pack-reused 6557
Receiving objects: 100% (6557/6557), 2.25 MiB | 118.00 KiB/s, done.
Resolving deltas: 100% (4921/4921), done.
Checking connectivity... done.
feb2018@adminxA MINGW32 /d/xampp/htdocs/php-webdriver
$ ls
1 - Copy.php example.php php-webdriver/ tests/
composer.json LICENSE README.md vendor/
composer.lock phpunit.xml selenium-server-standalone-3.9.1.jar
feb2018@adminxA MINGW32 /d/xampp/htdocs/php-webdriver
$ cd php-webdriver/
feb2018@adminxA MINGW32 /d/xampp/htdocs/php-webdriver/php-webdriver (community)
$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 55 installs, 0 updates, 0 removals
- Installing symfony/yaml (v3.4.6): Loading from cache
- Installing symfony/stopwatch (v3.4.6): Downloading (0%)
Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.7.0): Loading from cache
- Installing psr/log (1.0.2): Loading from cache
- Installing symfony/debug (v3.4.6): Loading from cache
- Installing symfony/console (v3.4.6): Loading from cache
- Installing symfony/filesystem (v3.4.6): Downloading (100%)
- Installing symfony/config (v3.4.6): Downloading (100%)
- Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)
- Installing guzzlehttp/guzzle (6.3.0): Downloading (100%)
- Installing php-coveralls/php-coveralls (v2.0.0): Downloading (100%)
- Installing jakub-onderka/php-parallel-lint (v0.9.2): Downloading (100%)
- Installing sebastian/resource-operations (1.0.0): Loading from cache
- Installing sebastian/diff (1.4.3): Downloading (100%)
- Installing symfony/process (v3.4.6): Loading from cache
- Installing symfony/polyfill-php72 (v1.7.0): Downloading (100%)
- Installing paragonie/random_compat (v2.0.11): Downloading (100%)
- Installing symfony/polyfill-php70 (v1.7.0): Downloading (100%)
- Installing symfony/options-resolver (v3.4.6): Downloading (100%)
- Installing symfony/finder (v3.4.6): Loading from cache
- Installing symfony/event-dispatcher (v3.4.6): Loading from cache
- Installing php-cs-fixer/diff (v1.3.0): Downloading (100%)
- Installing doctrine/lexer (v1.0.1): Downloading (100%)
- Installing doctrine/annotations (v1.4.0): Downloading (100%)
- Installing composer/semver (1.4.2): Downloading (100%)
- Installing friendsofphp/php-cs-fixer (v2.10.4): Downloading (100%)
- Installing squizlabs/php_codesniffer (2.9.1): Downloading (100%)
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing php-mock/php-mock (1.0.1): Downloading (100%)
- Installing php-mock/php-mock-integration (1.0.0): Downloading (100%)
- Installing sebastian/version (2.0.1): Loading from cache
- Installing sebastian/recursion-context (2.0.0): Downloading (100%)
- Installing sebastian/object-enumerator (2.0.1): Downloading (100%)
- Installing sebastian/global-state (1.1.1): Downloading (100%)
- Installing sebastian/exporter (2.0.0): Downloading (100%)
- Installing sebastian/environment (2.0.0): Downloading (100%)
- Installing sebastian/comparator (1.2.4): Downloading (100%)
- Installing doctrine/instantiator (1.0.5): Loading from cache
- Installing phpunit/phpunit-mock-objects (3.4.4): Downloading (100%)
- Installing phpunit/php-timer (1.0.9): Loading from cache
- Installing phpunit/php-file-iterator (1.4.5): Loading from cache
- Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
- Installing phpunit/php-token-stream (2.0.2): Loading from cache
- Installing phpunit/php-code-coverage (4.0.8): Downloading (100%)
- Installing webmozart/assert (1.3.0): Loading from cache
- Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
- Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
- Installing phpspec/prophecy (1.7.5): Loading from cache
- Installing myclabs/deep-copy (1.7.0): Loading from cache
- Installing phpunit/phpunit (5.7.27): Downloading (100%)
- Installing php-mock/php-mock-phpunit (1.1.2): Downloading (0%)
Downloading (100%)
- Installing symfony/var-dumper (v3.4.6): Downloading (100%)
symfony/console suggests installing symfony/lock ()
php-coveralls/php-coveralls suggests installing symfony/http-kernel (Allows Symfony integration)
jakub-onderka/php-parallel-lint suggests installing jakub-onderka/php-console-highlighter (Highlight syntax in code snippet)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
php-mock/php-mock suggests installing php-mock/php-mock-mockery (Allows using PHPMockery for Mockery integration)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
symfony/var-dumper suggests installing ext-symfony_debug ()
Writing lock file
Generating autoload files
feb2018@adminxA MINGW32 /d/xampp/htdocs/php-webdriver/php-webdriver (community)
$ ls
CHANGELOG.md composer.lock ISSUE_TEMPLATE.md logs/ README.md
CODE_OF_CONDUCT.md CONTRIBUTING.md lib/ phpstan.neon tests/
composer.json example.php LICENCE.md phpunit.xml.dist vendor/
feb2018@adminxA MINGW32 /d/xampp/htdocs/php-webdriver/php-webdriver (community)
$ php example.php
PHP Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for h
ttp POST to /session with params: {"desiredCapabilities":{"browserName":"firefox","platform":"ANY","fir
efox_profile":"UEsDBBQAAAAAAFtFaUzf9RXUMgAAADIAAAAHAAAAdXNlci5qc3VzZXJfcHJlZigicmVhZGVyLnBhcnNlLW9uLWxv
YWQuZW5hYmxlZCIsIGZhbHNlKTsKUEsBAhQDFAAAAAAAW0VpTN\/1FdQyAAAAMgAAAAcAAAAAAAAAAAAAALaBAAAAAHVzZXIuanNQSw
UGAAAAAAEAAQA1AAAAVwAAAAAA"}}
Failed to connect to localhost port 4444: Connection refused in D:\xampp\htdocs\php-webdriver\php-webdr
iver\lib\Remote\HttpCommandExecutor.php:292
Stack trace:
#0 D:\xampp\htdocs\php-webdriver\php-webdriver\lib\Remote\RemoteWebDriver.php(126): Facebook\WebDriver\
Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#1 D:\xampp\htdocs\php-webdriver\php-webdriver\example.php(14): Facebook\WebDriver\Remote\RemoteWebDriv
er::create('http://localhos...', Object(Facebook\WebDriver\Remote\DesiredCapabilities), 5000)
#2 {main}
thrown in D:\xampp\htdocs\php-webdriver\php-webdriver\lib\Remote\HttpCommandExecutor.php on line 292
Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http P
OST to /session with params: {"desiredCapabilities":{"browserName":"firefox","platform":"ANY","firefox_
profile":"UEsDBBQAAAAAAFtFaUzf9RXUMgAAADIAAAAHAAAAdXNlci5qc3VzZXJfcHJlZigicmVhZGVyLnBhcnNlLW9uLWxvYWQuZ
W5hYmxlZCIsIGZhbHNlKTsKUEsBAhQDFAAAAAAAW0VpTN\/1FdQyAAAAMgAAAAcAAAAAAAAAAAAAALaBAAAAAHVzZXIuanNQSwUGAAA
AAAEAAQA1AAAAVwAAAAAA"}}
Failed to connect to localhost port 4444: Connection refused in D:\xampp\htdocs\php-webdriver\php-webdr
iver\lib\Remote\HttpCommandExecutor.php:292
Stack trace:
#0 D:\xampp\htdocs\php-webdriver\php-webdriver\lib\Remote\RemoteWebDriver.php(126): Facebook\WebDriver\
Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#1 D:\xampp\htdocs\php-webdriver\php-webdriver\example.php(14): Facebook\WebDriver\Remote\RemoteWebDriv
er::create('http://localhos...', Object(Facebook\WebDriver\Remote\DesiredCapabilities), 5000)
#2 {main}
thrown in D:\xampp\htdocs\php-webdriver\php-webdriver\lib\Remote\HttpCommandExecutor.php on line 292
feb2018@adminxA MINGW32 /d/xampp/htdocs/php-webdriver/php-webdriver (community)
How could the issue be reproduced? (Steps to reproduce)
php example.php
<?php
// An example of using php-webdriver.
namespace Facebook\WebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
require_once('vendor/autoload.php');
// start Firefox with 5 second timeout
$host = 'http://localhost:4444/wd/hub'; // this is the default
$capabilities = DesiredCapabilities::firefox();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
// navigate to 'http://www.seleniumhq.org/'
$driver->get('http://www.seleniumhq.org/');
// adding cookie
$driver->manage()->deleteAllCookies();
$cookie = new Cookie('cookie_name', 'cookie_value');
$driver->manage()->addCookie($cookie);
$cookies = $driver->manage()->getCookies();
print_r($cookies);
// click the link 'About'
$link = $driver->findElement(
WebDriverBy::id('menu_about')
);
$link->click();
// wait until the page is loaded
$driver->wait()->until(
WebDriverExpectedCondition::titleContains('About')
);
// print the title of the current page
echo "The title is '" . $driver->getTitle() . "'\n";
// print the URI of the current page
echo "The current URI is '" . $driver->getCurrentURL() . "'\n";
// write 'php' in the search box
$driver->findElement(WebDriverBy::id('q'))
->sendKeys('php');
// submit the form
$driver->findElement(WebDriverBy::id('submit'))
->click(); // submit() does not work in Selenium 3 because of bug https://github.com/SeleniumHQ/selenium/issues/3398
// wait at most 10 seconds until at least one result is shown
$driver->wait(10)->until(
WebDriverExpectedCondition::presenceOfAllElementsLocatedBy(
WebDriverBy::className('gsc-result')
)
);
// close the Firefox
$driver->quit();
Details
Reactions are currently unavailable
What are you trying to achieve? (Expected behavior)
running example.php
What do you get instead? (Actual behavior)
How could the issue be reproduced? (Steps to reproduce)
Details