LoginSignup
4

More than 5 years have passed since last update.

【Selenium】php-webdriverでchromedriverを呼んだらunknown error: Chrome failed to start: exited abnormally

Posted at

環境

Debian 9
Selenium Standalone Server 3.8.1
ChromeDriver 2.34
Google Chrome 63.0
facebook/php-webdriver

起こった問題

こんなエラーが出る場合
Curl error thrown for http POST to /session with params: ...

まず、タイムアウトを延長して確認

// $driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities);
// タイムアウトを延長してみる
$driver = RemoteWebDriver::create('http://localhost:4444/wd/hub', $capabilities, 90000, 90000);

エラーが以下に変わったら
unknown error: Chrome failed to start: exited abnormally

以下のオプションを追加すると動きました。

$options->addArguments(['--no-sandbox']);

参考URL

https://blog.shimabox.net/2017/11/15/try_headless_chrome_and_firefox_with_php-webdriver/
https://github.com/SeleniumHQ/selenium/issues/4961

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4