From 09e780cfb710e91ff104912c06a68f9767758a77 Mon Sep 17 00:00:00 2001 From: Peter Singh Date: Wed, 12 Apr 2023 10:07:54 +0100 Subject: [PATCH] Try new headless Chrome https://developer.chrome.com/articles/new-headless/ --- lib/ferrum/browser/options/chrome.rb | 2 +- lib/ferrum/browser/process.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ferrum/browser/options/chrome.rb b/lib/ferrum/browser/options/chrome.rb index 1cce92df..d4745307 100644 --- a/lib/ferrum/browser/options/chrome.rb +++ b/lib/ferrum/browser/options/chrome.rb @@ -5,7 +5,7 @@ class Browser class Options class Chrome < Base DEFAULT_OPTIONS = { - "headless" => nil, + "headless" => "new", "disable-gpu" => nil, "hide-scrollbars" => nil, "mute-audio" => nil, diff --git a/lib/ferrum/browser/process.rb b/lib/ferrum/browser/process.rb index 9bf1ce8c..afad8b37 100644 --- a/lib/ferrum/browser/process.rb +++ b/lib/ferrum/browser/process.rb @@ -96,7 +96,15 @@ def start end env = Hash(@xvfb&.to_env).merge(@env) + + puts "Starting Chromium" + puts "---" + puts env, *@command.to_a, process_options + puts "---" + @pid = ::Process.spawn(env, *@command.to_a, process_options) + puts "Chromium started with PID: #{pid}" + ObjectSpace.define_finalizer(self, self.class.process_killer(@pid)) parse_ws_url(read_io, @process_timeout)