selenium-webdriver 4.36.0 → 4.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +14 -0
- data/bin/linux/selenium-manager +0 -0
- data/bin/macos/selenium-manager +0 -0
- data/bin/windows/selenium-manager.exe +0 -0
- data/lib/selenium/webdriver/bidi/network/cookies.rb +5 -8
- data/lib/selenium/webdriver/bidi/network/intercepted_request.rb +16 -4
- data/lib/selenium/webdriver/bidi/network/intercepted_response.rb +20 -6
- data/lib/selenium/webdriver/bidi/network.rb +12 -9
- data/lib/selenium/webdriver/bidi.rb +0 -1
- data/lib/selenium/webdriver/common/platform.rb +1 -3
- data/lib/selenium/webdriver/version.rb +1 -1
- data/selenium-webdriver.gemspec +0 -2
- metadata +2 -42
- data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +0 -35
- data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +0 -35
- data/lib/selenium/webdriver/bidi/log/filter_by.rb +0 -40
- data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +0 -33
- data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +0 -33
- data/lib/selenium/webdriver/bidi/log_inspector.rb +0 -147
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: caf0a29e3ecaf75eb2b31e1babd1849bc0427b17f94df59eeb8956e51b3217df
|
|
4
|
+
data.tar.gz: 5123da31c348a31ea0d03e037a6a57f151edef00c2ca414e469d7ade7ee9348b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f98f8df74d2f9e90d9041f97fb330cae1dfcf15e832005477ec2010568219f8f0ca059b1b2a5a0ee5b9662faf573f134b010331cdc30d6846fdeede558c1d4b4
|
|
7
|
+
data.tar.gz: a3b30b77b2b4695f6061a76492ec2621a0b2af7bc551fca217b7a55afcb4d858b7583176e43783d404372840d8b96cb4e6c94af052a373f88df7abb5888457cd
|
data/CHANGES
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
4.38.0 (2025-10-24)
|
|
2
|
+
=========================
|
|
3
|
+
* Fix BiDi Network issue by removing nil values on network requests (#16442)
|
|
4
|
+
* Remove cruft from old CI environment (#16473)
|
|
5
|
+
* [bidi] remove deprecated classes for log inspector (#16474)
|
|
6
|
+
* update devtools versions
|
|
7
|
+
|
|
8
|
+
4.37.0 (2025-10-16)
|
|
9
|
+
=========================
|
|
10
|
+
* Add CDP for Chrome 141 and remove 138
|
|
11
|
+
* Update Chrome/Edge args for test environment (#16376)
|
|
12
|
+
* Remove `prism` dependency (#16437)
|
|
13
|
+
* Remove `json` version constraint (#16436)
|
|
14
|
+
|
|
1
15
|
4.36.0 (2025-09-18)
|
|
2
16
|
=========================
|
|
3
17
|
* Add CDP for Chrome 140 and remove 137
|
data/bin/linux/selenium-manager
CHANGED
|
Binary file
|
data/bin/macos/selenium-manager
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -21,16 +21,13 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class BiDi
|
|
23
23
|
class Cookies < Hash
|
|
24
|
-
def initialize(cookies = {})
|
|
25
|
-
super()
|
|
26
|
-
merge!(cookies)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
24
|
def as_json
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
map do |name, val|
|
|
26
|
+
self[:name] = name.to_s
|
|
27
|
+
self[:value] = {type: 'string', value: val.to_s}
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
[compact]
|
|
30
|
+
end
|
|
34
31
|
end
|
|
35
32
|
end
|
|
36
33
|
end # BiDi
|
|
@@ -32,14 +32,18 @@ module Selenium
|
|
|
32
32
|
@method = nil
|
|
33
33
|
@url = nil
|
|
34
34
|
@body = nil
|
|
35
|
+
@headers = nil
|
|
36
|
+
@cookies = nil
|
|
35
37
|
end
|
|
36
38
|
|
|
37
39
|
def continue
|
|
40
|
+
cookies = @cookies&.as_json
|
|
41
|
+
headers = @headers&.as_json
|
|
38
42
|
network.continue_request(
|
|
39
43
|
id: id,
|
|
40
44
|
body: body,
|
|
41
|
-
cookies: cookies
|
|
42
|
-
headers: headers
|
|
45
|
+
cookies: cookies,
|
|
46
|
+
headers: headers,
|
|
43
47
|
method: method,
|
|
44
48
|
url: url
|
|
45
49
|
)
|
|
@@ -56,13 +60,21 @@ module Selenium
|
|
|
56
60
|
}
|
|
57
61
|
end
|
|
58
62
|
|
|
59
|
-
def headers
|
|
60
|
-
@headers
|
|
63
|
+
def headers=(headers = {})
|
|
64
|
+
@headers = Headers.new(headers)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def headers(headers = {})
|
|
68
|
+
@headers ||= Headers.new(headers)
|
|
61
69
|
end
|
|
62
70
|
|
|
63
71
|
def cookies(cookies = {})
|
|
64
72
|
@cookies ||= Cookies.new(cookies)
|
|
65
73
|
end
|
|
74
|
+
|
|
75
|
+
def cookies=(cookies = {})
|
|
76
|
+
@cookies = Cookies.new(cookies)
|
|
77
|
+
end
|
|
66
78
|
end
|
|
67
79
|
end # BiDi
|
|
68
80
|
end # WebDriver
|
|
@@ -33,13 +33,17 @@ module Selenium
|
|
|
33
33
|
@reason = nil
|
|
34
34
|
@status = nil
|
|
35
35
|
@body = nil
|
|
36
|
+
@headers = nil
|
|
37
|
+
@cookies = nil
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
def continue
|
|
41
|
+
cookies = @cookies&.as_json
|
|
42
|
+
headers = @headers&.as_json
|
|
39
43
|
network.continue_response(
|
|
40
44
|
id: id,
|
|
41
|
-
cookies: cookies
|
|
42
|
-
headers: headers
|
|
45
|
+
cookies: cookies,
|
|
46
|
+
headers: headers,
|
|
43
47
|
credentials: credentials.as_json,
|
|
44
48
|
reason: reason,
|
|
45
49
|
status: status
|
|
@@ -47,10 +51,12 @@ module Selenium
|
|
|
47
51
|
end
|
|
48
52
|
|
|
49
53
|
def provide_response
|
|
54
|
+
cookies = @cookies&.as_json
|
|
55
|
+
headers = @headers&.as_json
|
|
50
56
|
network.provide_response(
|
|
51
57
|
id: id,
|
|
52
|
-
cookies: cookies
|
|
53
|
-
headers: headers
|
|
58
|
+
cookies: cookies,
|
|
59
|
+
headers: headers,
|
|
54
60
|
body: body,
|
|
55
61
|
reason: reason,
|
|
56
62
|
status: status
|
|
@@ -61,14 +67,22 @@ module Selenium
|
|
|
61
67
|
@credentials ||= Credentials.new(username: username, password: password)
|
|
62
68
|
end
|
|
63
69
|
|
|
64
|
-
def headers
|
|
65
|
-
@headers ||= Headers.new
|
|
70
|
+
def headers(headers = {})
|
|
71
|
+
@headers ||= Headers.new(headers)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def headers=(*headers)
|
|
75
|
+
@headers = Headers.new(headers)
|
|
66
76
|
end
|
|
67
77
|
|
|
68
78
|
def cookies(cookies = {})
|
|
69
79
|
@cookies ||= Cookies.new(cookies)
|
|
70
80
|
end
|
|
71
81
|
|
|
82
|
+
def cookies=(cookies = {})
|
|
83
|
+
@cookies ||= Cookies.new(cookies)
|
|
84
|
+
end
|
|
85
|
+
|
|
72
86
|
def body=(value)
|
|
73
87
|
@body = {
|
|
74
88
|
type: 'string',
|
|
@@ -82,15 +82,16 @@ module Selenium
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
def continue_request(**args)
|
|
85
|
-
|
|
86
|
-
'network.continueRequest',
|
|
85
|
+
args = {
|
|
87
86
|
request: args[:id],
|
|
88
87
|
body: args[:body],
|
|
89
88
|
cookies: args[:cookies],
|
|
90
89
|
headers: args[:headers],
|
|
91
90
|
method: args[:method],
|
|
92
91
|
url: args[:url]
|
|
93
|
-
|
|
92
|
+
}.compact
|
|
93
|
+
|
|
94
|
+
@bidi.send_cmd('network.continueRequest', **args)
|
|
94
95
|
end
|
|
95
96
|
|
|
96
97
|
def fail_request(request_id)
|
|
@@ -101,27 +102,29 @@ module Selenium
|
|
|
101
102
|
end
|
|
102
103
|
|
|
103
104
|
def continue_response(**args)
|
|
104
|
-
|
|
105
|
-
'network.continueResponse',
|
|
105
|
+
args = {
|
|
106
106
|
request: args[:id],
|
|
107
107
|
cookies: args[:cookies],
|
|
108
108
|
credentials: args[:credentials],
|
|
109
109
|
headers: args[:headers],
|
|
110
110
|
reasonPhrase: args[:reason],
|
|
111
111
|
statusCode: args[:status]
|
|
112
|
-
|
|
112
|
+
}.compact
|
|
113
|
+
|
|
114
|
+
@bidi.send_cmd('network.continueResponse', **args)
|
|
113
115
|
end
|
|
114
116
|
|
|
115
117
|
def provide_response(**args)
|
|
116
|
-
|
|
117
|
-
'network.provideResponse',
|
|
118
|
+
args = {
|
|
118
119
|
request: args[:id],
|
|
119
120
|
body: args[:body],
|
|
120
121
|
cookies: args[:cookies],
|
|
121
122
|
headers: args[:headers],
|
|
122
123
|
reasonPhrase: args[:reason],
|
|
123
124
|
statusCode: args[:status]
|
|
124
|
-
|
|
125
|
+
}.compact
|
|
126
|
+
|
|
127
|
+
@bidi.send_cmd('network.provideResponse', **args)
|
|
125
128
|
end
|
|
126
129
|
|
|
127
130
|
def set_cache_behavior(behavior, *contexts)
|
|
@@ -21,7 +21,6 @@ module Selenium
|
|
|
21
21
|
module WebDriver
|
|
22
22
|
class BiDi
|
|
23
23
|
autoload :Session, 'selenium/webdriver/bidi/session'
|
|
24
|
-
autoload :LogInspector, 'selenium/webdriver/bidi/log_inspector'
|
|
25
24
|
autoload :LogHandler, 'selenium/webdriver/bidi/log_handler'
|
|
26
25
|
autoload :Browser, 'selenium/webdriver/bidi/browser'
|
|
27
26
|
autoload :BrowsingContext, 'selenium/webdriver/bidi/browsing_context'
|
data/selenium-webdriver.gemspec
CHANGED
|
@@ -50,9 +50,7 @@ Gem::Specification.new do |s|
|
|
|
50
50
|
s.require_paths = ['lib']
|
|
51
51
|
|
|
52
52
|
s.add_dependency 'base64', ['~> 0.2']
|
|
53
|
-
s.add_dependency 'json', ['<= 2.13.2']
|
|
54
53
|
s.add_dependency 'logger', ['~> 1.4']
|
|
55
|
-
s.add_dependency 'prism', ['~> 1.0', '< 1.5']
|
|
56
54
|
s.add_dependency 'rexml', ['~> 3.2', '>= 3.2.5']
|
|
57
55
|
s.add_dependency 'rubyzip', ['>= 1.2.2', '< 4.0']
|
|
58
56
|
s.add_dependency 'websocket', ['~> 1.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.
|
|
4
|
+
version: 4.38.0
|
|
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: 2025-10-
|
|
13
|
+
date: 2025-10-25 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: base64
|
|
@@ -26,20 +26,6 @@ dependencies:
|
|
|
26
26
|
- - "~>"
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
28
|
version: '0.2'
|
|
29
|
-
- !ruby/object:Gem::Dependency
|
|
30
|
-
name: json
|
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
|
32
|
-
requirements:
|
|
33
|
-
- - "<="
|
|
34
|
-
- !ruby/object:Gem::Version
|
|
35
|
-
version: 2.13.2
|
|
36
|
-
type: :runtime
|
|
37
|
-
prerelease: false
|
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
39
|
-
requirements:
|
|
40
|
-
- - "<="
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
version: 2.13.2
|
|
43
29
|
- !ruby/object:Gem::Dependency
|
|
44
30
|
name: logger
|
|
45
31
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -54,26 +40,6 @@ dependencies:
|
|
|
54
40
|
- - "~>"
|
|
55
41
|
- !ruby/object:Gem::Version
|
|
56
42
|
version: '1.4'
|
|
57
|
-
- !ruby/object:Gem::Dependency
|
|
58
|
-
name: prism
|
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
|
60
|
-
requirements:
|
|
61
|
-
- - "~>"
|
|
62
|
-
- !ruby/object:Gem::Version
|
|
63
|
-
version: '1.0'
|
|
64
|
-
- - "<"
|
|
65
|
-
- !ruby/object:Gem::Version
|
|
66
|
-
version: '1.5'
|
|
67
|
-
type: :runtime
|
|
68
|
-
prerelease: false
|
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
70
|
-
requirements:
|
|
71
|
-
- - "~>"
|
|
72
|
-
- !ruby/object:Gem::Version
|
|
73
|
-
version: '1.0'
|
|
74
|
-
- - "<"
|
|
75
|
-
- !ruby/object:Gem::Version
|
|
76
|
-
version: '1.5'
|
|
77
43
|
- !ruby/object:Gem::Dependency
|
|
78
44
|
name: rexml
|
|
79
45
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -319,13 +285,7 @@ files:
|
|
|
319
285
|
- lib/selenium/webdriver/bidi.rb
|
|
320
286
|
- lib/selenium/webdriver/bidi/browser.rb
|
|
321
287
|
- lib/selenium/webdriver/bidi/browsing_context.rb
|
|
322
|
-
- lib/selenium/webdriver/bidi/log/base_log_entry.rb
|
|
323
|
-
- lib/selenium/webdriver/bidi/log/console_log_entry.rb
|
|
324
|
-
- lib/selenium/webdriver/bidi/log/filter_by.rb
|
|
325
|
-
- lib/selenium/webdriver/bidi/log/generic_log_entry.rb
|
|
326
|
-
- lib/selenium/webdriver/bidi/log/javascript_log_entry.rb
|
|
327
288
|
- lib/selenium/webdriver/bidi/log_handler.rb
|
|
328
|
-
- lib/selenium/webdriver/bidi/log_inspector.rb
|
|
329
289
|
- lib/selenium/webdriver/bidi/network.rb
|
|
330
290
|
- lib/selenium/webdriver/bidi/network/cookies.rb
|
|
331
291
|
- lib/selenium/webdriver/bidi/network/credentials.rb
|
|
@@ -1,35 +0,0 @@
|
|
|
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 BiDi
|
|
23
|
-
class BaseLogEntry
|
|
24
|
-
attr_accessor :level, :text, :timestamp, :stack_trace
|
|
25
|
-
|
|
26
|
-
def initialize(level:, text:, timestamp:, stack_trace:)
|
|
27
|
-
@level = level
|
|
28
|
-
@text = text
|
|
29
|
-
@timestamp = timestamp
|
|
30
|
-
@stack_trace = stack_trace
|
|
31
|
-
end
|
|
32
|
-
end # BaseLogEntry
|
|
33
|
-
end # BiDi
|
|
34
|
-
end # WebDriver
|
|
35
|
-
end # Selenium
|
|
@@ -1,35 +0,0 @@
|
|
|
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 BiDi
|
|
23
|
-
class ConsoleLogEntry < GenericLogEntry
|
|
24
|
-
attr_accessor :method, :realm, :args
|
|
25
|
-
|
|
26
|
-
def initialize(method:, realm:, args:, **)
|
|
27
|
-
super(**)
|
|
28
|
-
@method = method
|
|
29
|
-
@realm = realm
|
|
30
|
-
@args = args
|
|
31
|
-
end
|
|
32
|
-
end # ConsoleLogEntry
|
|
33
|
-
end # BiDi
|
|
34
|
-
end # WebDriver
|
|
35
|
-
end # Selenium
|
|
@@ -1,40 +0,0 @@
|
|
|
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 BiDi
|
|
23
|
-
class FilterBy
|
|
24
|
-
attr_accessor :level
|
|
25
|
-
|
|
26
|
-
def initialize(level)
|
|
27
|
-
@level = level
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def self.log_level(level = nil)
|
|
31
|
-
unless %w[debug error info warning].include?(level)
|
|
32
|
-
raise Error::WebDriverError,
|
|
33
|
-
"Valid log levels are 'debug', 'error', 'info' and 'warning'. Received: #{level}"
|
|
34
|
-
end
|
|
35
|
-
FilterBy.new(level)
|
|
36
|
-
end
|
|
37
|
-
end # FilterBy
|
|
38
|
-
end # BiDi
|
|
39
|
-
end # WebDriver
|
|
40
|
-
end # Selenium
|
|
@@ -1,33 +0,0 @@
|
|
|
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 BiDi
|
|
23
|
-
class GenericLogEntry < BaseLogEntry
|
|
24
|
-
attr_accessor :type
|
|
25
|
-
|
|
26
|
-
def initialize(level:, text:, timestamp:, type:, stack_trace:)
|
|
27
|
-
super(level: level, text: text, timestamp: timestamp, stack_trace: stack_trace)
|
|
28
|
-
@type = type
|
|
29
|
-
end
|
|
30
|
-
end # GenericLogEntry
|
|
31
|
-
end # BiDi
|
|
32
|
-
end # WebDriver
|
|
33
|
-
end # Selenium
|
|
@@ -1,33 +0,0 @@
|
|
|
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 BiDi
|
|
23
|
-
class JavascriptLogEntry < GenericLogEntry
|
|
24
|
-
attr_accessor :type
|
|
25
|
-
|
|
26
|
-
def initialize(level:, text:, timestamp:, type:, stack_trace:)
|
|
27
|
-
super
|
|
28
|
-
@type = 'javascript'
|
|
29
|
-
end
|
|
30
|
-
end # JavascriptLogEntry
|
|
31
|
-
end # BiDi
|
|
32
|
-
end # WebDriver
|
|
33
|
-
end # Selenium
|
|
@@ -1,147 +0,0 @@
|
|
|
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
|
-
# This file is automatically generated. Any changes will be lost!
|
|
21
|
-
|
|
22
|
-
require_relative 'log/base_log_entry'
|
|
23
|
-
require_relative 'log/generic_log_entry'
|
|
24
|
-
require_relative 'log/console_log_entry'
|
|
25
|
-
require_relative 'log/javascript_log_entry'
|
|
26
|
-
require_relative 'log/filter_by'
|
|
27
|
-
|
|
28
|
-
module Selenium
|
|
29
|
-
module WebDriver
|
|
30
|
-
class BiDi
|
|
31
|
-
class LogInspector
|
|
32
|
-
EVENTS = {
|
|
33
|
-
entry_added: 'entryAdded'
|
|
34
|
-
}.freeze
|
|
35
|
-
|
|
36
|
-
LOG_LEVEL = {
|
|
37
|
-
DEBUG: 'debug',
|
|
38
|
-
ERROR: 'error',
|
|
39
|
-
INFO: 'info',
|
|
40
|
-
WARNING: 'warning'
|
|
41
|
-
}.freeze
|
|
42
|
-
|
|
43
|
-
def initialize(driver, browsing_context_ids = nil)
|
|
44
|
-
WebDriver.logger.deprecate('LogInspector class',
|
|
45
|
-
'Script class with driver.script',
|
|
46
|
-
id: :log_inspector)
|
|
47
|
-
|
|
48
|
-
unless driver.capabilities.web_socket_url
|
|
49
|
-
raise Error::WebDriverError,
|
|
50
|
-
'WebDriver instance must support BiDi protocol'
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
@bidi = driver.bidi
|
|
54
|
-
@bidi.session.subscribe('log.entryAdded', browsing_context_ids)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def on_console_entry(filter_by = nil, &block)
|
|
58
|
-
check_valid_filter(filter_by)
|
|
59
|
-
|
|
60
|
-
on_log do |params|
|
|
61
|
-
type = params['type']
|
|
62
|
-
console_log_events(params, filter_by, &block) if type.eql?('console')
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def on_javascript_log(filter_by = nil, &block)
|
|
67
|
-
check_valid_filter(filter_by)
|
|
68
|
-
|
|
69
|
-
on_log do |params|
|
|
70
|
-
type = params['type']
|
|
71
|
-
javascript_log_events(params, filter_by, &block) if type.eql?('javascript')
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def on_javascript_exception(&block)
|
|
76
|
-
on_log do |params|
|
|
77
|
-
type = params['type']
|
|
78
|
-
javascript_log_events(params, FilterBy.log_level('error'), &block) if type.eql?('javascript')
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def on_log(filter_by = nil, &block)
|
|
83
|
-
unless filter_by.nil?
|
|
84
|
-
check_valid_filter(filter_by)
|
|
85
|
-
|
|
86
|
-
on(:entry_added) do |params|
|
|
87
|
-
yield(params) if params['level'] == filter_by.level
|
|
88
|
-
end
|
|
89
|
-
return
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
on(:entry_added, &block)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
private
|
|
96
|
-
|
|
97
|
-
def on(event, &block)
|
|
98
|
-
event = EVENTS[event] if event.is_a?(Symbol)
|
|
99
|
-
@bidi.add_callback("log.#{event}", &block)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def check_valid_filter(filter_by)
|
|
103
|
-
return if filter_by.nil? || filter_by.instance_of?(FilterBy)
|
|
104
|
-
|
|
105
|
-
raise "Pass valid FilterBy object. Received: #{filter_by.inspect}"
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def console_log_events(params, filter_by)
|
|
109
|
-
event = ConsoleLogEntry.new(
|
|
110
|
-
level: params['level'],
|
|
111
|
-
text: params['text'],
|
|
112
|
-
timestamp: params['timestamp'],
|
|
113
|
-
type: params['type'],
|
|
114
|
-
method: params['method'],
|
|
115
|
-
realm: params['realm'],
|
|
116
|
-
args: params['args'],
|
|
117
|
-
stack_trace: params['stackTrace']
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
unless filter_by.nil?
|
|
121
|
-
yield(event) if params['level'] == filter_by.level
|
|
122
|
-
return
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
yield(event)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def javascript_log_events(params, filter_by)
|
|
129
|
-
event = JavascriptLogEntry.new(
|
|
130
|
-
level: params['level'],
|
|
131
|
-
text: params['text'],
|
|
132
|
-
timestamp: params['timestamp'],
|
|
133
|
-
type: params['type'],
|
|
134
|
-
stack_trace: params['stackTrace']
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
unless filter_by.nil?
|
|
138
|
-
yield(event) if params['level'] == filter_by.level
|
|
139
|
-
return
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
yield(event)
|
|
143
|
-
end
|
|
144
|
-
end # LogInspector
|
|
145
|
-
end # Bidi
|
|
146
|
-
end # WebDriver
|
|
147
|
-
end # Selenium
|