From b2fb826dfd8f4d1354891f86e628bc41af6d55cf Mon Sep 17 00:00:00 2001 From: Dmitry Galinsky Date: Mon, 2 Dec 2024 17:30:06 +0300 Subject: [PATCH] Add Ferrum::Brower::Base.version method It returns the actual executable's version such as `Chromium 129.0.6668.89 built on Ubuntu 24.04.1 LTS` --- lib/ferrum/browser/options/base.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/ferrum/browser/options/base.rb b/lib/ferrum/browser/options/base.rb index 6ebc63ba..86161eff 100644 --- a/lib/ferrum/browser/options/base.rb +++ b/lib/ferrum/browser/options/base.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "singleton" +require "open3" module Ferrum class Browser @@ -12,6 +13,14 @@ def self.options instance end + # @return [String, nil] + def self.version + out, _ = Open3.capture2(detect_path, "--version") + out.strip + rescue Errno::ENOENT + nil + end + def to_h self.class::DEFAULT_OPTIONS end