lib/selenium/webdriver/chrome/options.rb in selenium-webdriver-3.142.7 vs lib/selenium/webdriver/chrome/options.rb in selenium-webdriver-4.0.0.alpha1
- old
+ new
@@ -18,13 +18,13 @@
# under the License.
module Selenium
module WebDriver
module Chrome
- class Options < WebDriver::Common::Options
+ class Options
attr_reader :args, :prefs, :options, :emulation, :extensions, :encoded_extensions
- attr_accessor :binary, :profile, :detach
+ attr_accessor :binary
KEY = 'goog:chromeOptions'
#
# Create a new Options instance.
@@ -47,12 +47,10 @@
@binary = opts.delete(:binary) || Chrome.path
@prefs = opts.delete(:prefs) || {}
@extensions = opts.delete(:extensions) || []
@options = opts.delete(:options) || {}
@emulation = opts.delete(:emulation) || {}
- @detach = opts.delete(:detach)
- @profile = opts.delete(:profile)
@encoded_extensions = []
end
#
# Add an extension by local path.
@@ -170,20 +168,18 @@
def as_json(*)
extensions = @extensions.map do |crx_path|
File.open(crx_path, 'rb') { |crx_file| Base64.strict_encode64 crx_file.read }
end
extensions.concat(@encoded_extensions)
- add_argument("--user-data-dir=#{@profile[:directory]}") if @profile
opts = @options
opts[:binary] = @binary if @binary
opts[:args] = @args.to_a if @args.any?
opts[:extensions] = extensions if extensions.any?
opts[:mobileEmulation] = @emulation unless @emulation.empty?
opts[:prefs] = @prefs unless @prefs.empty?
- opts[:detach] = @detach if !@detach.nil? && @detach != false
- {KEY => generate_as_json(opts)}
+ {KEY => opts}
end
end # Options
end # Chrome
end # WebDriver
end # Selenium