我正在使用 selenium、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 --version 谷歌浏览器 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 来说是不够的。