Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open ChromeDriver without Selenium Standalone Server. #299

Closed
any626 opened this issue May 21, 2016 · 9 comments · Fixed by #342
Closed

Can't open ChromeDriver without Selenium Standalone Server. #299

any626 opened this issue May 21, 2016 · 9 comments · Fixed by #342
Labels
bug Something isn't working

Comments

@any626
Copy link

any626 commented May 21, 2016

I did what the wiki said, which is the following:

<?php
  putenv("webdriver.chrome.driver=/path/to/chromedriver");
  $driver = ChromeDriver::start();

But the browser never opens. I can see in the Activity Manager and terminal that it opens up but ends up timing out.

PHP Fatal error:  Uncaught exception 'Facebook\WebDriver\Exception\TimeOutException' with message 'Timed out waiting for http://localhost:9515/status to become available after 20000 ms.' in /Users/.../php/vendor/facebook/webdriver/lib/Net/URLChecker.php:36

I successfully ran the chromedriver using the same file in both node and python bindings.

@php-denken
Copy link

Did you start a selenium server? Download it here http://www.seleniumhq.org/download/ (the 2.53.0 link) and start it with java -jar [downloaded file]. Java has to be installed on your machine.

@any626
Copy link
Author

any626 commented May 21, 2016

I didn't. The purpose of this is to run it without the server. Directly to the chrome driver.

@php-denken
Copy link

Forget what I said. It is early in the morning and I didn't read your question well. I had not recognized that you are trying to run in without the server🤐

@OndraM OndraM added the bug Something isn't working label Oct 12, 2016
@OndraM
Copy link
Collaborator

OndraM commented Oct 14, 2016

@php-denken Hi, do you still face the issue? As I was also not able to start the ChromeDriver directly, I've changed the way the standalone chrome driver is started. Could you please try using this branch to see if the issue lasts or not?

Its in a branch in mine fork.

If you change your composer.json to contain this:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/OndraM/php-webdriver"
    }
]

And then run
composer require facebook/webdriver:dev-symfony-process@dev
the updated version should be installed and you will be able to try it. Could you please test it?

@OndraM
Copy link
Collaborator

OndraM commented Nov 2, 2016

The way chrome processes are started was changed - please try in next php-webdriver and let us know if the problem persists!

@OndraM
Copy link
Collaborator

OndraM commented Jan 14, 2017

Should be fixed in php-webdriver 1.3.0.

@frankiejarrett
Copy link

frankiejarrett commented Jul 22, 2017

@OndraM I'm experiencing the same problem described here. Possible regression?

ChromeDriver 2.31.488774
Facebook\WebDriver 1.4.1

Test run.php bootstrap:

<?php

require __DIR__ . '/vendor/autoload.php';

putenv('webdriver.chrome.driver=/path/to/chromedriver');

$driver = Facebook\WebDriver\Chrome\ChromeDriver::start();

Output:

$ php run.php
PHP Fatal error:  Uncaught Facebook\WebDriver\Exception\TimeOutException: Timed out waiting for http://localhost:9515/status to become available after 20000 ms. in /var/www/project/vendor/facebook/webdriver/lib/Net/URLChecker.php:37
Stack trace:
#0 /var/www/project/vendor/facebook/webdriver/lib/Remote/Service/DriverService.php(93): Facebook\WebDriver\Net\URLChecker->waitUntilAvailable(20000, 'http://localhos...')
#1 /var/www/project/vendor/facebook/webdriver/lib/Remote/Service/DriverCommandExecutor.php(51): Facebook\WebDriver\Remote\Service\DriverService->start()
#2 /var/www/project/vendor/facebook/webdriver/lib/Chrome/ChromeDriver.php(51): Facebook\WebDriver\Remote\Service\DriverCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand))
#3 /var/www/project/vendor/facebook/webdriver/lib/Chrome/ChromeDriver.php(37): Facebook\WebDriver\Chrome\ChromeDriver->startSession(Object(Facebook\WebDriver\Rem in /var/www/project/vendor/facebook/webdriver/lib/Net/URLChecker.php on line 37

Fatal error: Uncaught Facebook\WebDriver\Exception\TimeOutException: Timed out waiting for http://localhost:9515/status to become available after 20000 ms. in /var/www/project/vendor/facebook/webdriver/lib/Net/URLChecker.php on line 37

Facebook\WebDriver\Exception\TimeOutException: Timed out waiting for http://localhost:9515/status to become available after 20000 ms. in /var/www/project/vendor/facebook/webdriver/lib/Net/URLChecker.php on line 37

Call Stack:
    0.0002     355192   1. {main}() /var/www/project/run.php:0
    0.0028     500448   2. Facebook\WebDriver\Chrome\ChromeDriver::start() /var/www/project/run.php:7
    0.0060     676544   3. Facebook\WebDriver\Chrome\ChromeDriver->startSession() /var/www/project/vendor/facebook/webdriver/lib/Chrome/ChromeDriver.php:37
    0.0065     694056   4. Facebook\WebDriver\Remote\Service\DriverCommandExecutor->execute() /var/www/project/vendor/facebook/webdriver/lib/Chrome/ChromeDriver.php:51
    0.0065     694056   5. Facebook\WebDriver\Chrome\ChromeDriverService->start() /var/www/project/vendor/facebook/webdriver/lib/Remote/Service/DriverCommandExecutor.php:51
    0.0140    1076776   6. Facebook\WebDriver\Net\URLChecker->waitUntilAvailable() /var/www/project/vendor/facebook/webdriver/lib/Remote/Service/DriverService.php:93

Response from http://localhost:9515/status:

{
  "sessionId": "",
  "status": 0,
  "value": {
    "build": {
      "version": "alpha"
    },
    "os": {
      "arch": "x86_64",
      "name": "Mac OS X",
      "version": "10.12.6"
    }
  }
}

@frankiejarrett
Copy link

So after a lot of digging I finally that discovered that PHP builds installed with Homebrew using the --with-homebrew-curl flag will not play nice with WebDriver.

The problem went away after I ran this:

brew unlink php71
brew uninstall php71 --force --ignore-dependencies
brew cleanup
brew install php71

@OndraM
Copy link
Collaborator

OndraM commented Jul 24, 2017

@fjarrett Thanks for the information! Would be useful for others when facing the same issue :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants