Skip to content

Commit 62744b3

Browse files
committed
Convert noProxy from string to array in W3C new session payload
Related to #5004
1 parent ef8b1bf commit 62744b3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ def as_json(*)
249249
if value
250250
hash['proxy'] = value.as_json
251251
hash['proxy']['proxyType'] &&= hash['proxy']['proxyType'].downcase
252+
if hash['proxy']['noProxy'].is_a?(String)
253+
hash['proxy']['noProxy'] = hash['proxy']['noProxy'].split(', ')
254+
end
252255
end
253256
when String, :firefox_binary
254257
hash[key.to_s] = value

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ module W3C
2727
caps = described_class.new(proxy: proxy)
2828
expect(caps.as_json['proxy']['proxyType']).to eq('manual')
2929
end
30+
31+
it 'converts noProxy from string to array' do
32+
proxy = Selenium::WebDriver::Proxy.new(no_proxy: 'proxy_url, localhost')
33+
caps = described_class.new(proxy: proxy)
34+
expect(caps.as_json['proxy']['noProxy']).to eq(['proxy_url', 'localhost'])
35+
end
36+
37+
it 'does not convert noProxy if it is already array' do
38+
proxy = Selenium::WebDriver::Proxy.new(no_proxy: ['proxy_url'])
39+
caps = described_class.new(proxy: proxy)
40+
expect(caps.as_json['proxy']['noProxy']).to eq(['proxy_url'])
41+
end
3042
end
3143
end # W3C
3244
end # Remote

0 commit comments

Comments
 (0)