lib/scrap_kit/recipe.rb in scrap_kit-0.1.10 vs lib/scrap_kit/recipe.rb in scrap_kit-0.1.11
- old
+ new
@@ -2,10 +2,12 @@
require "webdrivers/chromedriver"
require "watir"
module ScrapKit
class Recipe
+ attr_accessor :user_agent
+
class << self
def load(source)
input = if source.is_a?(Hash)
source
elsif source.is_a?(IO)
@@ -199,9 +201,10 @@
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument "--headless"
options.add_argument "--window-size=1080x720"
options.add_argument "--hide-scrollbars"
+ options.add_argument "--user-agent=#{@user_agent}" if @user_agent
if chrome_bin = ENV["GOOGLE_CHROME_SHIM"]
options.add_argument "--no-sandbox"
options.binary = chrome_bin
end