Skip to content

Commit 69847e9

Browse files
committed
Pass waits to bidi bridge
1 parent 41e2533 commit 69847e9

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

rb/lib/selenium/webdriver/common/driver.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,21 @@ def ref
320320
attr_reader :bridge
321321

322322
def create_bridge(caps:, url:, http_client: nil)
323-
klass = caps['webSocketUrl'] ? Remote::BiDiBridge : Remote::Bridge
324-
klass.new(http_client: http_client, url: url).tap do |bridge|
323+
if caps['webSocketUrl']
324+
ws_options =
325+
{
326+
response_timeout: caps['wsResponseTimeout'],
327+
response_interval: caps['wsResponseInterval']
328+
}.compact
329+
330+
klass = Remote::BiDiBridge
331+
bridge_opts = { http_client: http_client, url: url, ws_options: ws_options }
332+
else
333+
klass = Remote::Bridge
334+
bridge_opts = { http_client: http_client, url: url }
335+
end
336+
337+
klass.new(**bridge_opts).tap do |bridge|
325338
bridge.create_session(caps)
326339
end
327340
end

rb/lib/selenium/webdriver/remote/bidi_bridge.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ module Remote
2323
class BiDiBridge < Bridge
2424
attr_reader :bidi
2525

26+
def initialize(url:, http_client: nil, ws_options: {})
27+
super(url: url, http_client: http_client)
28+
@ws_options = ws_options
29+
end
30+
2631
def create_session(capabilities)
2732
super
2833
socket_url = @capabilities[:web_socket_url]
29-
@bidi = Selenium::WebDriver::BiDi.new(url: socket_url)
34+
@bidi = Selenium::WebDriver::BiDi.new(url: socket_url, options: @ws_options)
3035
end
3136

3237
def get(url)

0 commit comments

Comments
 (0)