lib/quke/driver_configuration.rb in quke-0.9.1 vs lib/quke/driver_configuration.rb in quke-0.10.0

- old
+ new

@@ -110,11 +110,11 @@ "--load-images=no", "--disk-cache=false", "--ignore-ssl-errors=yes" ] - options.push("--proxy=#{config.proxy['host']}:#{config.proxy['port']}") if config.use_proxy? + options.push("--proxy=#{config.proxy.host}:#{config.proxy.port}") if config.proxy.use_proxy? options end # Returns an instance of Selenium::WebDriver::Chrome::Options to be @@ -145,19 +145,17 @@ # browser: :chrome, # options: my_driver_config.chrome # ) # def chrome - host = config.proxy["host"] - port = config.proxy["port"] - no_proxy = config.proxy["no_proxy"].tr(",", ";") + no_proxy = config.proxy.no_proxy.tr(",", ";") options = Selenium::WebDriver::Chrome::Options.new options.headless! if config.headless - options.add_argument("--proxy-server=#{host}:#{port}") if config.use_proxy? - options.add_argument("--proxy-bypass-list=#{no_proxy}") unless config.proxy["no_proxy"].empty? + options.add_argument("--proxy-server=#{config.proxy.host}:#{config.proxy.port}") if config.proxy.use_proxy? + options.add_argument("--proxy-bypass-list=#{no_proxy}") unless config.proxy.no_proxy.empty? options.add_argument("--user-agent=#{config.user_agent}") unless config.user_agent.empty? options end @@ -247,15 +245,10 @@ def firefox_profile profile = Selenium::WebDriver::Firefox::Profile.new profile["general.useragent.override"] = config.user_agent unless config.user_agent.empty? - settings = {} - settings[:http] = "#{config.proxy['host']}:#{config.proxy['port']}" if config.use_proxy? - settings[:ssl] = settings[:http] if config.use_proxy? - settings[:no_proxy] = config.proxy["no_proxy"] unless config.proxy["no_proxy"].empty? - - profile.proxy = Selenium::WebDriver::Proxy.new(settings) if config.use_proxy? + profile.proxy = Selenium::WebDriver::Proxy.new(config.proxy.firefox_settings) if config.proxy.use_proxy? profile end end