Codeception: Can't connect to Webdriver although chromedriver is running

What do you get instead?

First, I use

chromedriver --url-base=/wd/hub

to run chromdriver.

It shows that:

Starting ChromeDriver 2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

And then I use

codecept run -vvv

It shows that:

Codeception PHP Testing Framework v2.5.3
Powered by PHPUnit 6.5.14 by Sebastian Bergmann and contributors.
Running with seed:


Acceptance Tests (1) ---------------------------------------------------------------------------------------
Modules: WebDriver, \Helper\Acceptance
------------------------------------------------------------------------------------------------------------
UserCest: Try to test
Signature: UserCest:tryToTest
Test: tests/acceptance/UserCest.php:tryToTest
Scenario --
  Curl error: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome"}}

  Empty reply from server
  WebDriver::debugWebDriverLogs method has been called when webDriver is not set
  WebDriver::_saveScreenshot method has been called when webDriver is not set
  WebDriver::_savePageSource method has been called when webDriver is not set
  Screenshot and page source were saved into '/Users/cx/Documents/Code/fangPHP/data/web/tests/_output/' dir
 ERROR

------------------------------------------------------------------------------------------------------------

1) UserCest: Try to test
 Test  tests/acceptance/UserCest.php:tryToTest

  [ConnectionException] Can't connect to Webdriver at http://127.0.0.1:9515/wd/hub. Please make sure that Selenium Server or PhantomJS is running.

phar:///usr/local/bin/codecept/src/Codeception/Module/WebDriver.php:1450
phar:///usr/local/bin/codecept/src/Codeception/Module/WebDriver.php:426
phar:///usr/local/bin/codecept/src/Codeception/Subscriber/Module.php:56
phar:///usr/local/bin/codecept/vendor/symfony/event-dispatcher/EventDispatcher.php:212
phar:///usr/local/bin/codecept/vendor/symfony/event-dispatcher/EventDispatcher.php:44
phar:///usr/local/bin/codecept/vendor/codeception/phpunit-wrapper/src/Listener.php:133
phar:///usr/local/bin/codecept/vendor/codeception/phpunit-wrapper/src/Listener.php:102
phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestResult.php:395
phar:///usr/local/bin/codecept/src/Codeception/Test/Test.php:75
phar:///usr/local/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestSuite.php:755
phar:///usr/local/bin/codecept/vendor/codeception/phpunit-wrapper/src/Runner.php:110
phar:///usr/local/bin/codecept/src/Codeception/SuiteManager.php:158
phar:///usr/local/bin/codecept/src/Codeception/Codecept.php:192
phar:///usr/local/bin/codecept/src/Codeception/Codecept.php:159
phar:///usr/local/bin/codecept/src/Codeception/Command/Run.php:495
phar:///usr/local/bin/codecept/src/Codeception/Command/Run.php:390
phar:///usr/local/bin/codecept/vendor/symfony/console/Command/Command.php:264
phar:///usr/local/bin/codecept/vendor/symfony/console/Application.php:874
phar:///usr/local/bin/codecept/vendor/symfony/console/Application.php:228
phar:///usr/local/bin/codecept/vendor/symfony/console/Application.php:130
phar:///usr/local/bin/codecept/src/Codeception/Application.php:108
phar:///usr/local/bin/codecept/codecept:38
/usr/local/bin/codecept:7

Details

  • Codeception version:2.5.3
  • PHP Version:7.1.16
  • Operating System: MAC
  • Installation type: Phar
  • Suite configuration:
actor: AcceptanceTester
modules:
    enabled:
        - WebDriver:
            url: 'http://o.ftqq.com/'
            window_size: false # disabled in ChromeDriver
            port: 9515
            browser: chrome
        - \Helper\Acceptance

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

I’m also having the same issue. Please provide a detailed solution!

Hello,I wrote my suggestion on it just now.I hope it will help you.