From 9bd2b9b09b637b038998c5065678a6a98c42bbe9 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..af9ca133 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 "env: #{env}" + puts "*@command.to_a: #{*@command.to_a}" + puts "process_options: #{process_options}" + @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)