[rb] Don't create `caps[:firefox_options]` unless needed
@@ -65,17 +65,18 @@ module Selenium
def create_capabilities(opts)
caps = Remote::W3CCapabilities.firefox
caps.merge!(opts.delete(:desired_capabilities)) if opts.key? :desired_capabilities
- firefox_options_caps = caps[:firefox_options] || {}
- caps[:firefox_options] = firefox_options_caps.merge(opts[:firefox_options] || {})
+ firefox_options = caps[:firefox_options] || {}
+ firefox_options = firefox_options_caps.merge(opts[:firefox_options]) if opts.key?(:firefox_options)
if opts.key?(:profile)
profile = opts.delete(:profile)
unless profile.is_a?(Profile)
profile = Profile.from_name(profile)
end
- caps[:firefox_options][:profile] = profile.encoded
+ firefox_options[:profile] = profile.encoded
end
- Binary.path = caps[:firefox_options][:binary] if caps[:firefox_options].key?(:binary)
+ Binary.path = firefox_options[:binary] if firefox_options.key?(:binary)
+ caps[:firefox_options] = firefox_options unless firefox_options.empty?
caps
end
end # W3CBridge
