Skip to content

Commit 8db558f

Browse files
committed
Prevent defining overwriten proxy/timeouts= methods in capabilities
Fixes warnings like these: ./rb/lib/selenium/webdriver/remote/capabilities.rb:204: warning: method redefined; discarding old proxy= ./rb/lib/selenium/webdriver/remote/capabilities.rb:52: warning: previous definition of proxy= was here ./rb/lib/selenium/webdriver/remote/capabilities.rb:215: warning: method redefined; discarding old timeouts ./rb/lib/selenium/webdriver/remote/capabilities.rb:48: warning: previous definition of timeouts was here
1 parent 6ced1c1 commit 8db558f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Capabilities
4444
:remote_session_id
4545
].freeze
4646

47-
KNOWN.each do |key|
47+
(KNOWN - %i[proxy timeouts]).each do |key|
4848
define_method key do
4949
@capabilities.fetch(key)
5050
end
@@ -201,6 +201,10 @@ def merge!(other)
201201
end
202202
end
203203

204+
def proxy
205+
@capabilities.fetch(:proxy)
206+
end
207+
204208
def proxy=(proxy)
205209
case proxy
206210
when Hash
@@ -216,6 +220,10 @@ def timeouts
216220
@capabilities[:timeouts] ||= {}
217221
end
218222

223+
def timeouts=(timeouts)
224+
@capabilities[:timeouts] = timeouts
225+
end
226+
219227
def implicit_timeout
220228
timeouts[:implicit]
221229
end

0 commit comments

Comments
 (0)