Skip to content

Commit 752077a

Browse files
committed
Cleanup deprecated capabilities/options processing
1 parent b56d110 commit 752077a

File tree

8 files changed

+2
-110
lines changed

8 files changed

+2
-110
lines changed

rb/lib/selenium/webdriver/chrome/driver.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ def create_capabilities(opts)
6868
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.chrome }
6969
options = opts.delete(:options) { Options.new }
7070

71-
args = opts.delete(:args) || opts.delete(:switches)
72-
if args
73-
WebDriver.logger.deprecate ':args or :switches', 'Selenium::WebDriver::Chrome::Options#add_argument'
74-
raise ArgumentError, ':args must be an Array of Strings' unless args.is_a? Array
75-
76-
args.each { |arg| options.add_argument(arg.to_s) }
77-
end
78-
7971
profile = opts.delete(:profile)
8072
if profile
8173
profile = profile.as_json
@@ -94,14 +86,6 @@ def create_capabilities(opts)
9486
detach = opts.delete(:detach)
9587
options.add_option(:detach, true) if detach
9688

97-
prefs = opts.delete(:prefs)
98-
if prefs
99-
WebDriver.logger.deprecate ':prefs', 'Selenium::WebDriver::Chrome::Options#add_preference'
100-
prefs.each do |key, value|
101-
options.add_preference(key, value)
102-
end
103-
end
104-
10589
options = options.as_json
10690
caps.merge!(options) unless options[Options::KEY].empty?
10791

rb/lib/selenium/webdriver/firefox/driver.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,6 @@ def quit
6161
def create_capabilities(opts)
6262
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.firefox }
6363
options = opts.delete(:options) { Options.new }
64-
65-
firefox_options = opts.delete(:firefox_options)
66-
if firefox_options
67-
WebDriver.logger.deprecate ':firefox_options', 'Selenium::WebDriver::Firefox::Options'
68-
firefox_options.each do |key, value|
69-
options.add_option(key, value)
70-
end
71-
end
72-
73-
profile = opts.delete(:profile)
74-
if profile
75-
WebDriver.logger.deprecate ':profile', 'Selenium::WebDriver::Firefox::Options#profile='
76-
options.profile = profile
77-
end
78-
7964
options = options.as_json
8065
caps.merge!(options) unless options.empty?
8166

rb/lib/selenium/webdriver/ie/driver.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,6 @@ def quit
6060
def create_capabilities(opts)
6161
caps = opts.delete(:desired_capabilities) { Remote::Capabilities.internet_explorer }
6262
options = opts.delete(:options) { Options.new }
63-
64-
if opts.delete(:introduce_flakiness_by_ignoring_security_domains)
65-
WebDriver.logger.deprecate ':introduce_flakiness_by_ignoring_security_domains',
66-
'Selenium::WebDriver::IE::Options#ignore_protected_mode_settings='
67-
options.ignore_protected_mode_settings = true
68-
end
69-
70-
native_events = opts.delete(:native_events)
71-
unless native_events.nil?
72-
WebDriver.logger.deprecate ':native_events', 'Selenium::WebDriver::IE::Options#native_events='
73-
options.native_events = native_events
74-
end
75-
7663
options = options.as_json
7764
caps.merge!(options) unless options.empty?
7865

rb/lib/selenium/webdriver/remote/capabilities.rb

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ class Capabilities
4343
# remote-specific
4444
:remote_session_id,
4545

46-
# TODO: (AR) deprecate in favor of Firefox::Options?
47-
:accessibility_checks,
48-
:device,
49-
5046
# TODO: (AR) deprecate compatibility with OSS-capabilities
5147
:implicit_timeout,
5248
:page_load_timeout,
@@ -154,12 +150,6 @@ def json_create(data)
154150
# Remote Server Specific
155151
caps[:remote_session_id] = data.delete('webdriver.remote.sessionid') if data.key?('webdriver.remote.sessionid')
156152

157-
# Marionette Specific
158-
caps[:accessibility_checks] = data.delete('moz:accessibilityChecks') if data.key?('moz:accessibilityChecks')
159-
caps[:profile] = data.delete('moz:profile') if data.key?('moz:profile')
160-
caps[:rotatable] = data.delete('rotatable') if data.key?('rotatable')
161-
caps[:device] = data.delete('device') if data.key?('device')
162-
163153
# any remaining pairs will be added as is, with no conversion
164154
caps.merge!(data)
165155

@@ -233,10 +223,7 @@ def as_json(*)
233223
hash['proxy']['proxyType'] &&= hash['proxy']['proxyType'].downcase
234224
hash['proxy']['noProxy'] = hash['proxy']['noProxy'].split(', ') if hash['proxy']['noProxy'].is_a?(String)
235225
end
236-
when String, :firefox_binary
237-
if key == :firefox_binary && value
238-
WebDriver.logger.deprecate(':firefox_binary capabilitiy', 'Selenium::WebDriver::Firefox::Options#binary')
239-
end
226+
when String
240227
hash[key.to_s] = value
241228
when Symbol
242229
hash[camel_case(key.to_s)] = value

rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,6 @@ module Selenium
2323
module WebDriver
2424
module Chrome
2525
describe Driver, only: {driver: :chrome} do
26-
it 'accepts an array of custom command line arguments' do
27-
create_driver!(args: ['--user-agent=foo;bar']) do |driver|
28-
driver.navigate.to url_for('click_jacker.html')
29-
30-
ua = driver.execute_script 'return window.navigator.userAgent'
31-
expect(ua).to eq('foo;bar')
32-
end
33-
end
34-
35-
it 'raises ArgumentError if :args is not an Array' do
36-
expect { create_driver!(args: '--foo') }.to raise_error(ArgumentError, ':args must be an Array of Strings')
37-
end
38-
3926
it 'gets and sets network conditions' do
4027
driver.network_conditions = {offline: false, latency: 56, throughput: 789}
4128
expect(driver.network_conditions).to eq(

rb/spec/integration/selenium/webdriver/firefox/driver_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ module WebDriver
3131

3232
expect(caps.accept_insecure_certs).to be == false
3333
expect(caps.page_load_strategy).to be == 'normal'
34-
expect(caps.accessibility_checks).to be == false
3534
expect(caps.implicit_timeout).to be_zero
3635
expect(caps.page_load_timeout).to be == 300000
3736
expect(caps.script_timeout).to be == 30000

rb/spec/unit/selenium/webdriver/chrome/driver_spec.rb

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ module Chrome
3434
allow(Service).to receive(:new).and_return(service)
3535
end
3636

37-
it 'sets the args capability' do
38-
Driver.new(http_client: http, args: %w[--foo=bar])
39-
40-
expect(caps['goog:chromeOptions'][:args]).to eq(%w[--foo=bar])
41-
end
42-
43-
it 'sets the args capability from switches' do
44-
Driver.new(http_client: http, switches: %w[--foo=bar])
45-
46-
expect(caps['goog:chromeOptions'][:args]).to eq(%w[--foo=bar])
47-
end
48-
4937
it 'sets the proxy capabilitiy' do
5038
proxy = Proxy.new(http: 'localhost:1234')
5139
Driver.new(http_client: http, proxy: proxy)
@@ -65,12 +53,6 @@ module Chrome
6553
expect(caps['chrome.detach']).to be nil
6654
end
6755

68-
it 'sets the prefs capability' do
69-
Driver.new(http_client: http, prefs: {foo: 'bar'})
70-
71-
expect(caps['goog:chromeOptions'][:prefs]).to eq(foo: 'bar')
72-
end
73-
7456
it 'lets the user override chrome.detach' do
7557
Driver.new(http_client: http, detach: true)
7658

@@ -96,12 +78,11 @@ module Chrome
9678

9779
context 'with custom desired capabilities' do
9880
subject(:build_new_driver) do
99-
Driver.new(http_client: http, desired_capabilities: custom_caps, args: driver_args)
81+
Driver.new(http_client: http, desired_capabilities: custom_caps)
10082
end
10183

10284
let(:custom_caps) { Remote::Capabilities.new(cap_opts) }
10385
let(:cap_opts) { {chrome_options: {'foo' => 'bar'}} }
104-
let(:driver_args) { [] }
10586

10687
it 'takes desired capabilities' do
10788
expect(http).to receive(:call) do |_, _, payload|
@@ -112,20 +93,6 @@ module Chrome
11293
build_new_driver
11394
end
11495

115-
context 'with direct arguments' do
116-
let(:cap_opts) { {'goog:chromeOptions' => {args: %w[foo bar]}} }
117-
let(:driver_args) { %w[baz] }
118-
119-
it 'lets direct arguments take precedence over capabilities' do
120-
expect(http).to receive(:call) do |_, _, payload|
121-
expect(payload[:capabilities][:firstMatch][0]['goog:chromeOptions'][:args]).to eq(driver_args)
122-
resp
123-
end
124-
125-
build_new_driver
126-
end
127-
end
128-
12996
context 'with empty driver options' do
13097
let(:cap_opts) { {'goog:chromeOptions' => {args: %w[foo bar]}} }
13198

rb/spec/unit/selenium/webdriver/remote/capabilities_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ module Remote
110110
caps = Capabilities.new(browser_name: 'firefox', 'extension:customCapability': true)
111111
expect(caps).to eq(Capabilities.json_create(caps.as_json))
112112
end
113-
114-
it 'does not camel case the :firefox_binary capability' do
115-
expect(Capabilities.new(firefox_binary: '/foo/bar').as_json).to include('firefox_binary')
116-
end
117113
end
118114
end # Remote
119115
end # WebDriver

0 commit comments

Comments
 (0)