Skip to content

Commit 82485a9

Browse files
committed
Add support for bidi as an initialization parameter
1 parent 0342751 commit 82485a9

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

rb/lib/selenium/webdriver/common/options.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def set_capabilities
7171
def initialize(**opts)
7272
self.class.set_capabilities
7373

74+
opts[:web_socket_url] = opts.delete(:bidi) if opts.key?(:bidi)
75+
7476
@options = opts
7577
@options[:browser_name] = self.class::BROWSER
7678
end

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ module Chrome
6161

6262
driver.quit
6363
end
64+
65+
it 'enables BiDi on initialization' do
66+
quit_driver
67+
68+
options = Selenium::WebDriver::Options.chrome(bidi: true)
69+
expect(options.web_socket_url).to be true
70+
expect(options.bidi?).to be true
71+
72+
driver = Selenium::WebDriver.for :chrome, options: options
73+
74+
expect(driver.capabilities.web_socket_url).to be_a String
75+
76+
driver.quit
77+
end
6478
end
6579
end # Chrome
6680
end # WebDriver

rb/spec/integration/selenium/webdriver/edge/options_spec.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,38 @@ module Edge
4343
expect(ua).to eq('foo;bar')
4444
end
4545
end
46+
47+
it 'enables bidi' do
48+
quit_driver
49+
50+
options = Selenium::WebDriver::Options.chrome
51+
expect(options.web_socket_url).to be_nil
52+
expect(options.bidi?).to be false
53+
54+
options.enable_bidi!
55+
expect(options.web_socket_url).to be true
56+
expect(options.bidi?).to be true
57+
58+
driver = Selenium::WebDriver.for :chrome, options: options
59+
60+
expect(driver.capabilities.web_socket_url).to be_a String
61+
62+
driver.quit
63+
end
64+
65+
it 'enables BiDi on initialization' do
66+
quit_driver
67+
68+
options = Selenium::WebDriver::Options.chrome(bidi: true)
69+
expect(options.web_socket_url).to be true
70+
expect(options.bidi?).to be true
71+
72+
driver = Selenium::WebDriver.for :chrome, options: options
73+
74+
expect(driver.capabilities.web_socket_url).to be_a String
75+
76+
driver.quit
77+
end
4678
end
4779
end # Edge
4880
end # WebDriver

0 commit comments

Comments
 (0)