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
Either you have a firewall issue or chromedriver is not running.
Either you have a firewall issue or chromedriver is not running.
Thanks,But I dont have a firewall , the server is running in docker. i can access the web on 127.0.0.1 but i cant curl 127.0.0.1. if i curl 127.0.0.1 it shows
curl: (52) Empty reply from server
Either you have a firewall issue or chromedriver is not running.
Thanks again for your, I solved this problem, because I have been used
echo export ALL_PROXY=socks5://127.0.0.1:1080 >> ~/.zsh_profile
Give us more information about the solution. we are hitting the same issue
Give us more information about the solution. we are hitting the same issue
I'm also having this issue. Would be good to know how to resolve it @chenxiumiao Thanks
I'm also having the same issue. Any help is much appreciated!
I'm also having the same issue. Please provide a detailed solution!
If you use MACOS,you can check your PATH and delete this
ALL_PROXY=socks5://127.0.0.1:1080
this file is at ~/.bash_profile or ~/.zsh__profile.
Other OS, I'm so sorry that I can't offer useful advice.
Give us more information about the solution. we are hitting the same issue
If you use MACOS,you can check your PATH and delete this
ALL_PROXY=socks5://127.0.0.1:1080 this file is at ~/.bash_profile or ~/.zsh__profile.
Other OS, I'm so sorry that I can't offer useful advice.
Give us more information about the solution. we are hitting the same issue
I'm also having this issue. Would be good to know how to resolve it @chenxiumiao Thanks
If you use MACOS,you can check your PATH and delete this
ALL_PROXY=socks5://127.0.0.1:1080 this file is at ~/.bash_profile or ~/.zsh__profile.
Other OS, I'm so sorry that I can't offer useful advice.
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.
I also had a smilier issue, except I was running my chromedriver through jmeter.
I solved the issue by passing another argument to chormedriver
/path/to/chromedriver --whitelist-ip x.x.x.x.
This way chrome driver should be good to accept remote connections.
I hope this be helpful for someone else.
I met the same issue on MacOS, I replace the chromedriver version from 73 to 2.46. This issue resolved. I'm not sure what the root issue it is.
I also had a smilier issue, except I was running my chromedriver through jmeter. I solved the issue by passing another argument to chormedriver
/path/to/chromedriver --whitelist-ip x.x.x.x. This way chrome driver should be good to accept remote connections.I hope this be helpful for someone else.
Where did you put this line in JMeter?? I'm having the same issue, but I don't know where to put the whitelisted ip... I only have the Chrome Driver Config and the Web Driver Sampler in my test, writting the whitedlist ip in the web driver didn't solved the problem.
Web Driver Sampler

Chrome Driver Config

Thank you in advance
Check this out.
Hi All,
I am trying to run the chrome driver on linux machine for running my automation test cases via jenkins. But getting below error: Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 7321 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Starting ChromeDriver 73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72) on port 9515 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Invalid --log-level value. Unable to initialize logging. Exiting... org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromedriver is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Linux 3.10.0-327.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 116 milliseconds
I have also tried passing arguments --no-sandbox and --headless using chrome options. As per the suggestions shared earlier.
Any help will be appreciated.
Thanks you in advance.
Resources: Maven, Chrome,ChromeDriver, Linux(Debian), Java, Testng, jenkins
Link I followed for basic Linux (Debian) set up : https://stgconsulting.com/running-automated-selenium-tests-from-jenkins-on-linux/
Before solution we have been seeing this below error:
[INFO ] 2019-09-20 09:41:19.341 [main] BaseClass - browserName value is : chrome [INFO ] 2019-09-20 09:41:19.341 [main] BaseClass - chrome driver is here Starting ChromeDriver 78.0.3904.11 (eaaae9de6b8999773fa33f92ce1e1bbe294437cf-refs/branch-heads/3904@{#86}) on port 29688 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. [INFO ] 2019-09-20 09:41:23.904 [main] SetUpTest - ========================================================== [INFO ] 2019-09-20 09:41:23.904 [main] SetUpTest - =========== createAccount Test case is Started.
After solution I am not seeing failure/error and I am able to execute lest on Linux (Debian):
[INFO ] 2019-09-20 08:46:30.675 [main] BaseClass - chrome driver is here Starting ChromeDriver 75.0.3770.140 (2d9f97485c7b07dc18a74666574f19176731995c-refs/branch-heads/3770@{#1155}) on port 9770 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. [1568994392.814][WARNING]: This version of ChromeDriver has not been tested with Chrome version 76. Sep 20, 2019 8:46:33 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C [INFO ] 2019-09-20 08:46:33.227 [main] BaseClass - Browser is Chrome
solution steps and information:
(1) You can have latest Chrome Linux Browser on your box (2) Go here https://chromedriver.chromium.org/downloads and do bruteforce of ChromeDriver versions (3) I am using Chrome linux 77 (as of now 9/20/2019) and chromedriver 76.0.3809.25 , worked for me (3) "Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code" - got nothing with firewall (4) Check your Chmod 777 permission for chromeDriver
It's a BROWSER AND CHROME DRIVER MISMTACH , ALL YOU NEED TO DO IS TO CHECK THE COMPATIBILITY