+23
-10
lines changedFilter options
+23
-10
lines changed Original file line number Diff line number Diff line change
@@ -57,7 +57,8 @@ class Options < WebDriver::Options
57
57
#
58
58
59
59
def initialize(log_level: nil, **opts)
60
-
@debugger_address = opts.delete(:debugger_address)
60
+
@debugger_address = opts.delete(:debugger_address) { true }
61
+
opts[:accept_insecure_certs] = true unless opts.key?(:accept_insecure_certs)
61
62
62
63
super(**opts)
63
64
Original file line number Diff line number Diff line change
@@ -195,7 +195,6 @@ def create_remote_driver(**opts)
195
195
def create_firefox_driver(**opts)
196
196
WebDriver::Firefox.path = ENV.fetch('FIREFOX_BINARY', nil) if ENV.key?('FIREFOX_BINARY')
197
197
options = opts.delete(:options) { WebDriver::Options.firefox }
198
-
options.debugger_address = true
199
198
options.web_socket_url = true
200
199
options.add_argument('--headless') if ENV['HEADLESS']
201
200
WebDriver::Driver.for(:firefox, options: options, **opts)
Original file line number Diff line number Diff line change
@@ -49,8 +49,10 @@ def expect_request(body: nil, endpoint: nil)
49
49
50
50
it 'accepts provided Options as sole parameter' do
51
51
opts = {invalid: 'foobar', args: ['-f']}
52
-
expect_request(body: {capabilities: {alwaysMatch: {browserName: "firefox", 'moz:firefoxOptions': opts}}})
53
-
52
+
expect_request(body: {capabilities: {alwaysMatch: {acceptInsecureCerts: true,
53
+
browserName: "firefox",
54
+
'moz:firefoxOptions': opts,
55
+
'moz:debuggerAddress': true}}})
54
56
expect { Driver.new(options: Options.new(**opts)) }.not_to raise_exception
55
57
end
56
58
@@ -99,9 +101,10 @@ def as_json(*)
99
101
100
102
it 'with Options instance' do
101
103
options = Options.new(args: ['-f'])
102
-
expect_request(body: {capabilities: {alwaysMatch: {browserName: "firefox",
103
-
'moz:firefoxOptions': {args: ['-f']}}}})
104
-
104
+
expect_request(body: {capabilities: {alwaysMatch: {acceptInsecureCerts: true,
105
+
browserName: "firefox",
106
+
'moz:firefoxOptions': {args: ['-f']},
107
+
'moz:debuggerAddress': true}}})
105
108
expect { Driver.new(capabilities: [options]) }.not_to raise_exception
106
109
end
107
110
@@ -113,8 +116,10 @@ def as_json(*)
113
116
end
114
117
115
118
it 'with Options instance and an instance of a custom object responding to #as_json' do
116
-
expect_request(body: {capabilities: {alwaysMatch: {browserName: "firefox",
119
+
expect_request(body: {capabilities: {alwaysMatch: {acceptInsecureCerts: true,
120
+
browserName: "firefox",
117
121
'moz:firefoxOptions': {},
122
+
'moz:debuggerAddress': true,
118
123
'company:key': 'value'}}})
119
124
expect { Driver.new(capabilities: [Options.new, as_json_object.new]) }.not_to raise_exception
120
125
end
@@ -123,7 +128,9 @@ def as_json(*)
123
128
capabilities = Remote::Capabilities.new(browser_name: 'firefox', invalid: 'foobar')
124
129
options = Options.new(args: ['-f'])
125
130
expect_request(body: {capabilities: {alwaysMatch: {browserName: "firefox", invalid: 'foobar',
131
+
acceptInsecureCerts: true,
126
132
'moz:firefoxOptions': {args: ['-f']},
133
+
'moz:debuggerAddress': true,
127
134
'company:key': 'value'}}})
128
135
129
136
expect { Driver.new(capabilities: [capabilities, options, as_json_object.new]) }.not_to raise_exception
Original file line number Diff line number Diff line change
@@ -190,14 +190,19 @@ module Firefox
190
190
191
191
describe '#as_json' do
192
192
it 'returns empty options by default' do
193
-
expect(options.as_json).to eq("browserName" => "firefox", "moz:firefoxOptions" => {})
193
+
expect(options.as_json).to eq("browserName" => "firefox",
194
+
"acceptInsecureCerts" => true,
195
+
"moz:firefoxOptions" => {},
196
+
"moz:debuggerAddress" => true)
194
197
end
195
198
196
199
it 'returns added options' do
197
200
options.add_option(:foo, 'bar')
198
201
options.add_option('foo:bar', {foo: 'bar'})
199
-
expect(options.as_json).to eq("browserName" => "firefox",
202
+
expect(options.as_json).to eq("acceptInsecureCerts" => true,
203
+
"browserName" => "firefox",
200
204
"foo:bar" => {"foo" => "bar"},
205
+
"moz:debuggerAddress" => true,
201
206
"moz:firefoxOptions" => {"foo" => "bar"})
202
207
end
203
208
@@ -241,6 +246,7 @@ module Firefox
241
246
'implicit' => 1},
242
247
'setWindowRect' => false,
243
248
'custom:options' => {'foo' => 'bar'},
249
+
'moz:debuggerAddress' => true,
244
250
key => {'args' => %w[foo bar],
245
251
'binary' => '/foo/bar',
246
252
'prefs' => {'foo' => 'bar'},
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4