From 06e89766db380d7c6960d6c443e5b52df153ccb7 Mon Sep 17 00:00:00 2001 From: Radu Date: Mon, 12 Nov 2018 12:11:03 +0200 Subject: [PATCH] Modifying configurations in order to accept User_Agent --- lib/wraith/helpers/save_metadata.rb | 5 +++++ lib/wraith/save_images.rb | 3 +++ lib/wraith/wraith.rb | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/lib/wraith/helpers/save_metadata.rb b/lib/wraith/helpers/save_metadata.rb index 68749c47..ffc7218a 100644 --- a/lib/wraith/helpers/save_metadata.rb +++ b/lib/wraith/helpers/save_metadata.rb @@ -31,4 +31,9 @@ def compare_label def engine wraith.engine end + + def selenium_options + wraith.selenium_options + end + end diff --git a/lib/wraith/save_images.rb b/lib/wraith/save_images.rb index 151e3c6f..6f57ad63 100644 --- a/lib/wraith/save_images.rb +++ b/lib/wraith/save_images.rb @@ -106,6 +106,9 @@ def get_driver 'hide-scrollbars', 'ignore-certificate-errors' ].each { |arg| options.add_argument("--#{arg}") } + meta.selenium_options.each do |opt| + options.add_argument(opt) + end Selenium::WebDriver.for :chrome, options: options end end diff --git a/lib/wraith/wraith.rb b/lib/wraith/wraith.rb index 2d686b3f..cdb9a9ab 100644 --- a/lib/wraith/wraith.rb +++ b/lib/wraith/wraith.rb @@ -82,6 +82,10 @@ def engine engine end + def selenium_options + @config["selenium_options"].to_a + end + def snap_file @config["snap_file"] ? convert_to_absolute(@config["snap_file"]) : snap_file_from_engine(engine) end