Die Option "no-sandbox / disable-dev-shm-usage" ist erforderlich, wenn Capybara / Selen / Chromedriver in einer CUI-Umgebung wie der Dokcer-Umgebung verwendet wird.
Selenium::WebDriver::Error::UnknownError:
unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
capybara.rb
...
Capybara.register_driver :selenium_chrome_headless do |app|
options = ::Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--no-sandbox') #Umgebung durch Chroot isoliert(Sandbox)Deaktiviert den Betrieb in
options.add_argument('--disable-dev-shm-usage') #Der Speicherort der gemeinsam genutzten Speicherdatei/dev/von shm/Gehen Sie zu tmp
options.add_argument('--disable-gpu')
options.add_argument('--window-size=2500,2500')
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end
Capybara.javascript_driver = :selenium_chrome_headless
Recommended Posts