此版本的ChromeDriver尚未通过Selenium ChromeDriver和Chrome通过facebook / php-webdriver与Chrome版本75错误进行测试

时间:2019-06-24 03:41:42

标签: selenium google-chrome selenium-webdriver selenium-chromedriver facebook-php-webdriver

我正在使用硒,chromedriver,facebook / php-webdriver 但是服务器总是在发生错误后挂起 可能是什么问题呢?硒还是PHP?

这是php错误:

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

来自硒记录:

[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

版本信息:

  • ChromeDriver 2.35.528139
  • Chrome浏览器-版本Google Chrome浏览器75.0.3770.80

+++++++++++++++++++++++

更新于6月29日,我已将chromdriver更新为75.0.3770.90,但问题仍然存在。没有任何变化。

+++++++++++++++++++++++ 2019年6月30日

我已经解决了这个问题,通过“ top”命令,我看到一个名为kswapd0的进度消耗了太多的CPU。这是与交换相关的进度,因此我将此行添加到/etc/sysctl.conf中: vm.swappiness = 5 并且有更多的RAM,该服务已经运行了一天。而且不再挂了。 我没有意识到默认配置的1.8GB RAM不足以支持chrome。

1 个答案:

答案 0 :(得分:1)

此php错误消息...

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

和此硒错误消息...

[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

...表示 ChromeDriver 无法启动/产生新的 WebBrowser ,即 Chrome浏览器会话。

您的主要问题是所使用的二进制版本之间的不兼容性

  • 您正在使用 chromedriver = 2.35
  • chromedriver=2.35的发行说明中明确提到以下内容:
  

支持 Chrome v62-64

  • 您正在使用 chrome = 75.0
  • ChromeDriver v75.0的发行说明中明确提到以下内容:
  

支持 Chrome 75版

因此 ChromeDriver v2.35 Chrome浏览器v75.0

之间存在明显的不匹配

解决方案


Outro