Skip to content

Commit 441337f

Browse files
Handle Selenium "options" deprecation (#2118)
Silences this warning while running "bundle exec rspec": WARN Selenium [DEPRECATION] [:browser_options] :options as a parameter for driver initialization is deprecated. Use :capabilities with an Array of value capabilities/options if necessary instead. But with a cleaner approach from that introduced in #2064.
1 parent 87b0622 commit 441337f

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

spec/support/webdrivers.rb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@
55
end
66

77
Capybara.register_driver :headless_chrome do |app|
8+
options = ::Selenium::WebDriver::Chrome::Options.new
9+
options.headless!
10+
options.add_argument "--window-size=1680,1050"
11+
options.add_argument "--disable-gpu"
12+
options.add_argument "--disable-dev-shm-usage"
13+
814
Capybara::Selenium::Driver.new(
915
app,
1016
browser: :chrome,
11-
capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
12-
"goog:chromeOptions" => {
13-
"args" => [
14-
"window-size=1680,1050",
15-
"headless",
16-
"disable-gpu",
17-
"disable-dev-shm-usage",
18-
],
19-
},
20-
),
17+
capabilities: [options],
2118
)
2219
end
2320

0 commit comments

Comments
 (0)