selenium-webdriver 4.0.0.beta4 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +18 -0
- data/lib/selenium/webdriver/chrome/driver.rb +1 -0
- data/lib/selenium/webdriver/common/driver.rb +3 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +1 -6
- data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +77 -0
- data/lib/selenium/webdriver/common/element.rb +17 -8
- data/lib/selenium/webdriver/common/error.rb +12 -0
- data/lib/selenium/webdriver/common/shadow_root.rb +87 -0
- data/lib/selenium/webdriver/common.rb +2 -0
- data/lib/selenium/webdriver/devtools/pinned_script.rb +59 -0
- data/lib/selenium/webdriver/devtools.rb +1 -0
- data/lib/selenium/webdriver/ie/options.rb +3 -1
- data/lib/selenium/webdriver/ie/service.rb +1 -1
- data/lib/selenium/webdriver/remote/bridge.rb +30 -13
- data/lib/selenium/webdriver/remote/capabilities.rb +2 -2
- data/lib/selenium/webdriver/remote/commands.rb +3 -0
- data/lib/selenium/webdriver/remote/driver.rb +1 -0
- data/lib/selenium/webdriver/remote.rb +1 -1
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +2 -2
- data/lib/selenium/webdriver/version.rb +1 -1
- data/selenium-webdriver.gemspec +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e8ac87a660228e7b93c7fe07095cc7b01a0795dc6069bd60d8b41c01d16a3e3
|
4
|
+
data.tar.gz: 9a46eca7af76f4362c23fd2036e1a4ba8c736b598ae78a5f6db3b1affdc618c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ba51c6f9e1db77a7a17f786af9d908eb2156ccd5ff39456248c1ceaefccfda7f7ed99c5bde0929adb3787bba9798e939dad7f6504d0bc8d7492969696da8f16
|
7
|
+
data.tar.gz: ac0de71814328f449a521b12df535d11699e1fe9adb83f10c9456106befc7de689cf8e69893301e5f87437d330241eef805a25abda3768d74791f5fc42bd88db
|
data/CHANGES
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
4.0.0.rc1 (2021-09-01)
|
2
|
+
=========================
|
3
|
+
|
4
|
+
DevTools:
|
5
|
+
* Released selenium-devtools 0.92.0 (2021-08-21) which:
|
6
|
+
- adds CDP versions 92
|
7
|
+
- removes CDP versions 88, 89, 90
|
8
|
+
|
9
|
+
IE:
|
10
|
+
* Added options for running Microsoft Edge in IE mode with IE Driver
|
11
|
+
|
12
|
+
Remote:
|
13
|
+
* Added default file detector for remote driver
|
14
|
+
|
15
|
+
Ruby:
|
16
|
+
* Fixed bug for getting valid capability that has not been set
|
17
|
+
* Fixed bug preventing loading of ServerError class
|
18
|
+
|
1
19
|
4.0.0.beta4 (2021-06-07)
|
2
20
|
=========================
|
3
21
|
|
@@ -112,8 +112,7 @@ module Selenium
|
|
112
112
|
|
113
113
|
devtools.runtime.add_binding(name: '__webdriver_attribute')
|
114
114
|
execute_script(mutation_listener)
|
115
|
-
|
116
|
-
pinned_scripts[mutation_listener] = script['identifier']
|
115
|
+
devtools.page.add_script_to_evaluate_on_new_document(source: mutation_listener)
|
117
116
|
|
118
117
|
devtools.runtime.on(:binding_called, &method(:log_mutation_event))
|
119
118
|
end
|
@@ -139,10 +138,6 @@ module Selenium
|
|
139
138
|
@mutation_listener ||= read_atom(:mutationListener)
|
140
139
|
end
|
141
140
|
|
142
|
-
def pinned_scripts
|
143
|
-
@pinned_scripts ||= {}
|
144
|
-
end
|
145
|
-
|
146
141
|
end # HasLogEvents
|
147
142
|
end # DriverExtensions
|
148
143
|
end # WebDriver
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
5
|
+
# distributed with this work for additional information
|
6
|
+
# regarding copyright ownership. The SFC licenses this file
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance
|
9
|
+
# with the License. You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
14
|
+
# software distributed under the License is distributed on an
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
+
# KIND, either express or implied. See the License for the
|
17
|
+
# specific language governing permissions and limitations
|
18
|
+
# under the License.
|
19
|
+
|
20
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
module DriverExtensions
|
23
|
+
module HasPinnedScripts
|
24
|
+
|
25
|
+
#
|
26
|
+
# Returns the list of all pinned scripts.
|
27
|
+
#
|
28
|
+
# @return [Array<DevTools::PinnedScript>]
|
29
|
+
#
|
30
|
+
|
31
|
+
def pinned_scripts
|
32
|
+
@pinned_scripts ||= []
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# Pins JavaScript snippet that is available during the whole
|
37
|
+
# session on every page. This allows to store and call
|
38
|
+
# scripts without sending them over the wire every time.
|
39
|
+
#
|
40
|
+
# @example
|
41
|
+
# script = driver.pin_script('return window.location.href')
|
42
|
+
# driver.execute_script(script)
|
43
|
+
# # navigate to a new page
|
44
|
+
# driver.execute_script(script)
|
45
|
+
#
|
46
|
+
# @param [String] script
|
47
|
+
# @return [DevTools::PinnedScript]
|
48
|
+
#
|
49
|
+
|
50
|
+
def pin_script(script)
|
51
|
+
script = DevTools::PinnedScript.new(script)
|
52
|
+
pinned_scripts << script
|
53
|
+
|
54
|
+
devtools.page.enable
|
55
|
+
devtools.runtime.evaluate(expression: script.callable)
|
56
|
+
response = devtools.page.add_script_to_evaluate_on_new_document(source: script.callable)
|
57
|
+
script.devtools_identifier = response.dig('result', 'identifier')
|
58
|
+
|
59
|
+
script
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Unpins script making it undefined for the subsequent calls.
|
64
|
+
#
|
65
|
+
# @param [DevTools::PinnedScript]
|
66
|
+
#
|
67
|
+
|
68
|
+
def unpin_script(script)
|
69
|
+
devtools.runtime.evaluate(expression: script.remove)
|
70
|
+
devtools.page.remove_script_to_evaluate_on_new_document(identifier: script.devtools_identifier)
|
71
|
+
pinned_scripts.delete(script)
|
72
|
+
end
|
73
|
+
|
74
|
+
end # HasPinnedScripts
|
75
|
+
end # DriverExtensions
|
76
|
+
end # WebDriver
|
77
|
+
end # Selenium
|
@@ -143,7 +143,7 @@ module Selenium
|
|
143
143
|
#
|
144
144
|
|
145
145
|
def dom_attribute(name)
|
146
|
-
bridge.element_dom_attribute
|
146
|
+
bridge.element_dom_attribute @id, name
|
147
147
|
end
|
148
148
|
|
149
149
|
#
|
@@ -157,7 +157,7 @@ module Selenium
|
|
157
157
|
#
|
158
158
|
|
159
159
|
def property(name)
|
160
|
-
bridge.element_property
|
160
|
+
bridge.element_property @id, name
|
161
161
|
end
|
162
162
|
|
163
163
|
#
|
@@ -167,7 +167,7 @@ module Selenium
|
|
167
167
|
#
|
168
168
|
|
169
169
|
def aria_role
|
170
|
-
bridge.element_aria_role
|
170
|
+
bridge.element_aria_role @id
|
171
171
|
end
|
172
172
|
|
173
173
|
#
|
@@ -177,7 +177,7 @@ module Selenium
|
|
177
177
|
#
|
178
178
|
|
179
179
|
def accessible_name
|
180
|
-
bridge.element_aria_label
|
180
|
+
bridge.element_aria_label @id
|
181
181
|
end
|
182
182
|
|
183
183
|
#
|
@@ -317,6 +317,16 @@ module Selenium
|
|
317
317
|
bridge.element_size @id
|
318
318
|
end
|
319
319
|
|
320
|
+
#
|
321
|
+
# Returns the shadow root of an element.
|
322
|
+
#
|
323
|
+
# @return [WebDriver::ShadowRoot]
|
324
|
+
#
|
325
|
+
|
326
|
+
def shadow_root
|
327
|
+
bridge.shadow_root @id
|
328
|
+
end
|
329
|
+
|
320
330
|
#-------------------------------- sugar --------------------------------
|
321
331
|
|
322
332
|
#
|
@@ -336,14 +346,13 @@ module Selenium
|
|
336
346
|
#
|
337
347
|
alias_method :[], :attribute
|
338
348
|
|
339
|
-
#
|
340
|
-
# for SearchContext and execute_script
|
341
349
|
#
|
342
350
|
# @api private
|
351
|
+
# @see SearchContext
|
343
352
|
#
|
344
353
|
|
345
354
|
def ref
|
346
|
-
@id
|
355
|
+
[:element, @id]
|
347
356
|
end
|
348
357
|
|
349
358
|
#
|
@@ -379,7 +388,7 @@ module Selenium
|
|
379
388
|
end
|
380
389
|
|
381
390
|
def screenshot
|
382
|
-
bridge.element_screenshot(
|
391
|
+
bridge.element_screenshot(@id)
|
383
392
|
end
|
384
393
|
end # Element
|
385
394
|
end # WebDriver
|
@@ -61,6 +61,12 @@ module Selenium
|
|
61
61
|
|
62
62
|
class StaleElementReferenceError < WebDriverError; end
|
63
63
|
|
64
|
+
#
|
65
|
+
# A command failed because the referenced shadow root is no longer attached to the DOM.
|
66
|
+
#
|
67
|
+
|
68
|
+
class DetachedShadowRootError < WebDriverError; end
|
69
|
+
|
64
70
|
#
|
65
71
|
# The target element is in an invalid state, rendering it impossible to interact with, for
|
66
72
|
# example if you click a disabled element.
|
@@ -93,6 +99,12 @@ module Selenium
|
|
93
99
|
|
94
100
|
class NoSuchWindowError < WebDriverError; end
|
95
101
|
|
102
|
+
#
|
103
|
+
# The element does not have a shadow root.
|
104
|
+
#
|
105
|
+
|
106
|
+
class NoSuchShadowRootError < WebDriverError; end
|
107
|
+
|
96
108
|
#
|
97
109
|
# An illegal attempt was made to set a cookie under a different domain than the current page.
|
98
110
|
#
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
5
|
+
# distributed with this work for additional information
|
6
|
+
# regarding copyright ownership. The SFC licenses this file
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance
|
9
|
+
# with the License. You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
14
|
+
# software distributed under the License is distributed on an
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
+
# KIND, either express or implied. See the License for the
|
17
|
+
# specific language governing permissions and limitations
|
18
|
+
# under the License.
|
19
|
+
|
20
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
class ShadowRoot
|
23
|
+
ROOT_KEY = 'shadow-6066-11e4-a52e-4f735466cecf'
|
24
|
+
|
25
|
+
include SearchContext
|
26
|
+
|
27
|
+
#
|
28
|
+
# Creates a new shadow root
|
29
|
+
#
|
30
|
+
# @api private
|
31
|
+
#
|
32
|
+
|
33
|
+
def initialize(bridge, id)
|
34
|
+
@bridge = bridge
|
35
|
+
@id = id
|
36
|
+
end
|
37
|
+
|
38
|
+
def inspect
|
39
|
+
format '#<%<class>s:0x%<hash>x id=%<id>s>', class: self.class, hash: hash * 2, id: @id.inspect
|
40
|
+
end
|
41
|
+
|
42
|
+
def ==(other)
|
43
|
+
other.is_a?(self.class) && ref == other.ref
|
44
|
+
end
|
45
|
+
alias_method :eql?, :==
|
46
|
+
|
47
|
+
def hash
|
48
|
+
@id.hash ^ @bridge.hash
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# @api private
|
53
|
+
# @see SearchContext
|
54
|
+
#
|
55
|
+
|
56
|
+
def ref
|
57
|
+
[:shadow_root, @id]
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# Convert to a ShadowRoot JSON Object for transmission over the wire.
|
62
|
+
# @see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#basic-terms-and-concepts
|
63
|
+
#
|
64
|
+
# @api private
|
65
|
+
#
|
66
|
+
|
67
|
+
def to_json(*)
|
68
|
+
JSON.generate as_json
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# For Rails 3 - http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/
|
73
|
+
#
|
74
|
+
# @api private
|
75
|
+
#
|
76
|
+
|
77
|
+
def as_json(*)
|
78
|
+
{ROOT_KEY => @id}
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
attr_reader :bridge
|
84
|
+
|
85
|
+
end # ShadowRoot
|
86
|
+
end # WebDriver
|
87
|
+
end # Selenium
|
@@ -68,6 +68,7 @@ require 'selenium/webdriver/common/driver_extensions/has_devtools'
|
|
68
68
|
require 'selenium/webdriver/common/driver_extensions/has_authentication'
|
69
69
|
require 'selenium/webdriver/common/driver_extensions/has_logs'
|
70
70
|
require 'selenium/webdriver/common/driver_extensions/has_log_events'
|
71
|
+
require 'selenium/webdriver/common/driver_extensions/has_pinned_scripts'
|
71
72
|
require 'selenium/webdriver/common/driver_extensions/has_cdp'
|
72
73
|
require 'selenium/webdriver/common/keys'
|
73
74
|
require 'selenium/webdriver/common/profile_helper'
|
@@ -75,3 +76,4 @@ require 'selenium/webdriver/common/options'
|
|
75
76
|
require 'selenium/webdriver/common/takes_screenshot'
|
76
77
|
require 'selenium/webdriver/common/driver'
|
77
78
|
require 'selenium/webdriver/common/element'
|
79
|
+
require 'selenium/webdriver/common/shadow_root'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
5
|
+
# distributed with this work for additional information
|
6
|
+
# regarding copyright ownership. The SFC licenses this file
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance
|
9
|
+
# with the License. You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
14
|
+
# software distributed under the License is distributed on an
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
+
# KIND, either express or implied. See the License for the
|
17
|
+
# specific language governing permissions and limitations
|
18
|
+
# under the License.
|
19
|
+
|
20
|
+
module Selenium
|
21
|
+
module WebDriver
|
22
|
+
class DevTools
|
23
|
+
class PinnedScript
|
24
|
+
|
25
|
+
attr_accessor :key, :devtools_identifier, :script
|
26
|
+
|
27
|
+
def initialize(script)
|
28
|
+
@key = SecureRandom.alphanumeric
|
29
|
+
@script = script
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# @api private
|
34
|
+
#
|
35
|
+
|
36
|
+
def callable
|
37
|
+
"function __webdriver_#{key}(arguments) { #{script} }"
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# @api private
|
42
|
+
#
|
43
|
+
|
44
|
+
def to_json(*)
|
45
|
+
%{"return __webdriver_#{key}(arguments)"}
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# @api private
|
50
|
+
#
|
51
|
+
|
52
|
+
def remove
|
53
|
+
"__webdriver_#{key} = undefined"
|
54
|
+
end
|
55
|
+
|
56
|
+
end # PinnedScript
|
57
|
+
end # DevTools
|
58
|
+
end # WebDriver
|
59
|
+
end # Selenium
|
@@ -23,6 +23,7 @@ module Selenium
|
|
23
23
|
autoload :ConsoleEvent, 'selenium/webdriver/devtools/console_event'
|
24
24
|
autoload :ExceptionEvent, 'selenium/webdriver/devtools/exception_event'
|
25
25
|
autoload :MutationEvent, 'selenium/webdriver/devtools/mutation_event'
|
26
|
+
autoload :PinnedScript, 'selenium/webdriver/devtools/pinned_script'
|
26
27
|
autoload :Request, 'selenium/webdriver/devtools/request'
|
27
28
|
|
28
29
|
def initialize(url:)
|
@@ -39,7 +39,9 @@ module Selenium
|
|
39
39
|
persistent_hover: 'enablePersistentHover',
|
40
40
|
require_window_focus: 'requireWindowFocus',
|
41
41
|
use_per_process_proxy: 'ie.usePerProcessProxy',
|
42
|
-
|
42
|
+
use_legacy_file_upload_dialog_handling: 'ie.useLegacyFileUploadDialogHandling',
|
43
|
+
attach_to_edge_chrome: 'ie.edgechromium',
|
44
|
+
edge_executable_path: 'ie.edgepath'
|
43
45
|
}.freeze
|
44
46
|
BROWSER = 'internet explorer'
|
45
47
|
|
@@ -25,7 +25,7 @@ module Selenium
|
|
25
25
|
EXECUTABLE = 'IEDriverServer'
|
26
26
|
MISSING_TEXT = <<~ERROR
|
27
27
|
Unable to find IEDriverServer. Please download the server from
|
28
|
-
|
28
|
+
https://www.selenium.dev/downloads/ and place it somewhere on your PATH.
|
29
29
|
More info at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver.
|
30
30
|
ERROR
|
31
31
|
SHUTDOWN_SUPPORTED = true
|
@@ -269,7 +269,7 @@ module Selenium
|
|
269
269
|
end
|
270
270
|
|
271
271
|
def element_screenshot(element)
|
272
|
-
execute :take_element_screenshot, id: element
|
272
|
+
execute :take_element_screenshot, id: element
|
273
273
|
end
|
274
274
|
|
275
275
|
#
|
@@ -431,7 +431,7 @@ module Selenium
|
|
431
431
|
end
|
432
432
|
|
433
433
|
def submit_element(element)
|
434
|
-
form = find_element_by('xpath', "./ancestor-or-self::form", element)
|
434
|
+
form = find_element_by('xpath', "./ancestor-or-self::form", [:element, element])
|
435
435
|
execute_script("var e = arguments[0].ownerDocument.createEvent('Event');" \
|
436
436
|
"e.initEvent('submit', true, true);" \
|
437
437
|
'if (arguments[0].dispatchEvent(e)) { arguments[0].submit() }', form.as_json)
|
@@ -451,19 +451,19 @@ module Selenium
|
|
451
451
|
end
|
452
452
|
|
453
453
|
def element_dom_attribute(element, name)
|
454
|
-
execute :get_element_attribute, id: element
|
454
|
+
execute :get_element_attribute, id: element, name: name
|
455
455
|
end
|
456
456
|
|
457
457
|
def element_property(element, name)
|
458
|
-
execute :get_element_property, id: element
|
458
|
+
execute :get_element_property, id: element, name: name
|
459
459
|
end
|
460
460
|
|
461
461
|
def element_aria_role(element)
|
462
|
-
execute :get_element_aria_role, id: element
|
462
|
+
execute :get_element_aria_role, id: element
|
463
463
|
end
|
464
464
|
|
465
465
|
def element_aria_label(element)
|
466
|
-
execute :get_element_aria_label, id: element
|
466
|
+
execute :get_element_aria_label, id: element
|
467
467
|
end
|
468
468
|
|
469
469
|
def element_value(element)
|
@@ -524,13 +524,17 @@ module Selenium
|
|
524
524
|
|
525
525
|
alias_method :switch_to_active_element, :active_element
|
526
526
|
|
527
|
-
def find_element_by(how, what,
|
527
|
+
def find_element_by(how, what, parent_ref = [])
|
528
528
|
how, what = convert_locator(how, what)
|
529
529
|
|
530
530
|
return execute_atom(:findElements, Support::RelativeLocator.new(what).as_json).first if how == 'relative'
|
531
531
|
|
532
|
-
|
533
|
-
|
532
|
+
parent_type, parent_id = parent_ref
|
533
|
+
id = case parent_type
|
534
|
+
when :element
|
535
|
+
execute :find_child_element, {id: parent_id}, {using: how, value: what.to_s}
|
536
|
+
when :shadow_root
|
537
|
+
execute :find_shadow_child_element, {id: parent_id}, {using: how, value: what.to_s}
|
534
538
|
else
|
535
539
|
execute :find_element, {}, {using: how, value: what.to_s}
|
536
540
|
end
|
@@ -538,13 +542,17 @@ module Selenium
|
|
538
542
|
Element.new self, element_id_from(id)
|
539
543
|
end
|
540
544
|
|
541
|
-
def find_elements_by(how, what,
|
545
|
+
def find_elements_by(how, what, parent_ref = [])
|
542
546
|
how, what = convert_locator(how, what)
|
543
547
|
|
544
548
|
return execute_atom :findElements, Support::RelativeLocator.new(what).as_json if how == 'relative'
|
545
549
|
|
546
|
-
|
547
|
-
|
550
|
+
parent_type, parent_id = parent_ref
|
551
|
+
ids = case parent_type
|
552
|
+
when :element
|
553
|
+
execute :find_child_elements, {id: parent_id}, {using: how, value: what.to_s}
|
554
|
+
when :shadow_root
|
555
|
+
execute :find_shadow_child_elements, {id: parent_id}, {using: how, value: what.to_s}
|
548
556
|
else
|
549
557
|
execute :find_elements, {}, {using: how, value: what.to_s}
|
550
558
|
end
|
@@ -552,6 +560,11 @@ module Selenium
|
|
552
560
|
ids.map { |id| Element.new self, element_id_from(id) }
|
553
561
|
end
|
554
562
|
|
563
|
+
def shadow_root(element)
|
564
|
+
id = execute :get_element_shadow_root, id: element
|
565
|
+
ShadowRoot.new self, shadow_root_id_from(id)
|
566
|
+
end
|
567
|
+
|
555
568
|
private
|
556
569
|
|
557
570
|
#
|
@@ -599,7 +612,11 @@ module Selenium
|
|
599
612
|
end
|
600
613
|
|
601
614
|
def element_id_from(id)
|
602
|
-
id['ELEMENT'] || id[
|
615
|
+
id['ELEMENT'] || id[Element::ELEMENT_KEY]
|
616
|
+
end
|
617
|
+
|
618
|
+
def shadow_root_id_from(id)
|
619
|
+
id[ShadowRoot::ROOT_KEY]
|
603
620
|
end
|
604
621
|
|
605
622
|
def prepare_capabilities_payload(capabilities)
|
@@ -46,7 +46,7 @@ module Selenium
|
|
46
46
|
|
47
47
|
(KNOWN - %i[proxy timeouts]).each do |key|
|
48
48
|
define_method key do
|
49
|
-
@capabilities
|
49
|
+
@capabilities[key]
|
50
50
|
end
|
51
51
|
|
52
52
|
define_method "#{key}=" do |value|
|
@@ -202,7 +202,7 @@ module Selenium
|
|
202
202
|
end
|
203
203
|
|
204
204
|
def proxy
|
205
|
-
@capabilities
|
205
|
+
@capabilities[:proxy]
|
206
206
|
end
|
207
207
|
|
208
208
|
def proxy=(proxy)
|
@@ -77,7 +77,10 @@ module Selenium
|
|
77
77
|
find_elements: [:post, 'session/:session_id/elements'],
|
78
78
|
find_child_element: [:post, 'session/:session_id/element/:id/element'],
|
79
79
|
find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
|
80
|
+
find_shadow_child_element: [:post, 'session/:session_id/shadow/:id/element'],
|
81
|
+
find_shadow_child_elements: [:post, 'session/:session_id/shadow/:id/elements'],
|
80
82
|
get_active_element: [:get, 'session/:session_id/element/active'],
|
83
|
+
get_element_shadow_root: [:get, 'session/:session_id/element/:id/shadow'],
|
81
84
|
is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
|
82
85
|
get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
|
83
86
|
get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
|
@@ -18,6 +18,7 @@
|
|
18
18
|
# under the License.
|
19
19
|
|
20
20
|
require 'uri'
|
21
|
+
require 'selenium/webdriver/remote/server_error'
|
21
22
|
|
22
23
|
module Selenium
|
23
24
|
module WebDriver
|
@@ -25,7 +26,6 @@ module Selenium
|
|
25
26
|
autoload :Bridge, 'selenium/webdriver/remote/bridge'
|
26
27
|
autoload :Driver, 'selenium/webdriver/remote/driver'
|
27
28
|
autoload :Response, 'selenium/webdriver/remote/response'
|
28
|
-
autoload :ServerError, 'selenium/webdriver/remote/server_error'
|
29
29
|
autoload :Capabilities, 'selenium/webdriver/remote/capabilities'
|
30
30
|
autoload :COMMANDS, 'selenium/webdriver/remote/commands'
|
31
31
|
module Http
|
@@ -76,7 +76,7 @@ module Selenium
|
|
76
76
|
@delegate.find_element_by how, what, parent
|
77
77
|
end
|
78
78
|
|
79
|
-
Element.new self, e.ref
|
79
|
+
Element.new self, e.ref.last
|
80
80
|
end
|
81
81
|
|
82
82
|
def find_elements_by(how, what, parent = nil)
|
@@ -84,7 +84,7 @@ module Selenium
|
|
84
84
|
@delegate.find_elements_by(how, what, parent)
|
85
85
|
end
|
86
86
|
|
87
|
-
es.map { |e| Element.new self, e.ref }
|
87
|
+
es.map { |e| Element.new self, e.ref.last }
|
88
88
|
end
|
89
89
|
|
90
90
|
def execute_script(script, *args)
|
data/selenium-webdriver.gemspec
CHANGED
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
|
51
51
|
# childprocess requires ffi on windows but doesn't declare it in its dependencies
|
52
52
|
s.add_development_dependency 'ffi'
|
53
|
+
s.add_development_dependency 'pry', ['~> 0.14']
|
53
54
|
s.add_development_dependency 'rack', ['~> 2.0']
|
54
55
|
s.add_development_dependency 'rake'
|
55
56
|
s.add_development_dependency 'rspec', ['~> 3.0']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-webdriver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Rodionov
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-09-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: childprocess
|
@@ -74,6 +74,20 @@ dependencies:
|
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: pry
|
79
|
+
requirement: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0.14'
|
84
|
+
type: :development
|
85
|
+
prerelease: false
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.14'
|
77
91
|
- !ruby/object:Gem::Dependency
|
78
92
|
name: rack
|
79
93
|
requirement: !ruby/object:Gem::Requirement
|
@@ -249,6 +263,7 @@ files:
|
|
249
263
|
- lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb
|
250
264
|
- lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb
|
251
265
|
- lib/selenium/webdriver/common/driver_extensions/has_permissions.rb
|
266
|
+
- lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb
|
252
267
|
- lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb
|
253
268
|
- lib/selenium/webdriver/common/driver_extensions/has_session_id.rb
|
254
269
|
- lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb
|
@@ -282,6 +297,7 @@ files:
|
|
282
297
|
- lib/selenium/webdriver/common/search_context.rb
|
283
298
|
- lib/selenium/webdriver/common/service.rb
|
284
299
|
- lib/selenium/webdriver/common/service_manager.rb
|
300
|
+
- lib/selenium/webdriver/common/shadow_root.rb
|
285
301
|
- lib/selenium/webdriver/common/socket_lock.rb
|
286
302
|
- lib/selenium/webdriver/common/socket_poller.rb
|
287
303
|
- lib/selenium/webdriver/common/takes_screenshot.rb
|
@@ -294,6 +310,7 @@ files:
|
|
294
310
|
- lib/selenium/webdriver/devtools/console_event.rb
|
295
311
|
- lib/selenium/webdriver/devtools/exception_event.rb
|
296
312
|
- lib/selenium/webdriver/devtools/mutation_event.rb
|
313
|
+
- lib/selenium/webdriver/devtools/pinned_script.rb
|
297
314
|
- lib/selenium/webdriver/devtools/request.rb
|
298
315
|
- lib/selenium/webdriver/edge.rb
|
299
316
|
- lib/selenium/webdriver/edge/driver.rb
|