I'm using selenium, chromedriver, facebook/php-webdriver But the server always hang after an error What could be the problem? selenium or php?
here is the php error:
Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"w3c":false,"binary":"","args":["--no-sandbox","--headless","--disable-gpu"]}}} Operation timed out after 51627 milliseconds with 0 out of -1 bytes received in /var/www/html/php-selenium/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:297 Stack trace: #0 /var/www/html/php-selenium/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php(144): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand)) #1 /var/www/html/php-selenium/s.php(19): Facebook\WebDriver\Remote\RemoteWebDriver::create('http://localhos...', Object(Facebook\WebDriver\Remote\DesiredCapabilities), 50000, 50000) #2 {main} thrown in /var/www/html/php-selenium/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php on line 297
from selenium log:
[1561345982.225][WARNING]: This version of ChromeDriver has not been tested with Chrome version 75.
03:13:06.892 WARN - Exception thrown
org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'shadowsocks-server', ip: '10.140.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.21.3.el7.x86_64', java.version: '1.8.0_212'
Driver info: driver.version: unknown
Version Info:
+++++++++++++++++++++
updated June 29th, I have updated chromdriver to 75.0.3770.90, but the problem still persists. nothing changes.
+++++++++++++++++++++ June 30th,2019
I have solved this, with "top" command, I saw a progress whose name was kswapd0 consumed too much CPU. It is a progress which is related to swap, so I add this line to /etc/sysctl.conf: vm.swappiness=5 and got more RAM, the service has been running for a day. and no hanging any more. I didn't realize that 1.8GB RAM was not enough for chrome with default configration.
This php error message...
Fatal error: Uncaught Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"w3c":false,"binary":"","args":["--no-sandbox","--headless","--disable-gpu"]}}} Operation timed out after 51627 milliseconds with 0 out of -1 bytes received in /var/www/html/php-selenium/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:297 Stack trace: #0 /var/www/html/php-selenium/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php(144): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand)) #1 /var/www/html/php-selenium/s.php(19): Facebook\WebDriver\Remote\RemoteWebDriver::create('http://localhos...', Object(Facebook\WebDriver\Remote\DesiredCapabilities), 50000, 50000) #2 {main} thrown in /var/www/html/php-selenium/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php on line 297
and this selenium error message...
[WARNING]: This version of ChromeDriver has not been tested with Chrome version 75.
03:13:06.892 WARN - Exception thrown
org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Supports Chrome v62-64
Supports Chrome version 75
So there is a clear mismatch between ChromeDriver v2.35 and the Chrome Browser v75.0