Skip to content

Commit dc81624

Browse files
committed
Do not camelize Chrome localState object
It's common to use Chrome options local state to configure experimental options. We should avoid modifying these keys in any way similar to prefs object. options = Selenium::WebDriver::Chrome::Options.new options.add_option(:local_state, { 'browser.enabled_labs_experiments' => [ 'same-site-by-default-cookies@2', 'cookies-without-same-site-must-be-secure@2' ] }
1 parent f5989bf commit dc81624

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

rb/lib/selenium/webdriver/chrome/options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def validate_extension(path)
230230
end
231231

232232
def camelize?(key)
233-
!['prefs'].include?(key)
233+
!%w[localState prefs].include?(key)
234234
end
235235
end # Options
236236
end # Chrome

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@ module Chrome
251251
encoded_extensions: ['encoded_foobar'],
252252
foo: 'bar',
253253
emulation: {device_name: :mine},
254-
local_state: {foo: 'bar'},
254+
local_state: {
255+
foo: 'bar',
256+
key_that_should_not_be_camelcased: 'baz',
257+
},
255258
detach: true,
256259
debugger_address: '127.0.0.1:8181',
257260
exclude_switches: %w[foobar barfoo],
@@ -279,7 +282,10 @@ module Chrome
279282
'extensions' => %w[encoded_foobar encoded_foo encoded_bar],
280283
'foo' => 'bar',
281284
'mobileEmulation' => {'deviceName' => 'mine'},
282-
'localState' => {'foo' => 'bar'},
285+
'localState' => {
286+
'foo' => 'bar',
287+
'key_that_should_not_be_camelcased' => 'baz',
288+
},
283289
'detach' => true,
284290
'debuggerAddress' => '127.0.0.1:8181',
285291
'excludeSwitches' => %w[foobar barfoo],

0 commit comments

Comments
 (0)