appium_lib_core 14.0.0 → 14.1.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/CHANGELOG.md +13 -0
- data/lib/appium_lib_core/common/base/bridge.rb +64 -0
- data/lib/appium_lib_core/common/base/driver.rb +6 -11
- data/lib/appium_lib_core/common/base.rb +0 -1
- data/lib/appium_lib_core/version.rb +2 -2
- data/sig/lib/appium_lib_core/common/base/bridge.rbs +17 -0
- data/sig/lib/appium_lib_core/common/base/driver.rbs +1 -1
- metadata +1 -3
- data/lib/appium_lib_core/common/base/bidi_bridge.rb +0 -100
- data/sig/lib/appium_lib_core/common/base/bidi_bridge.rbs +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9359ffb00a01237b935e603c3fc243e2373ed523f4ff0d10596f0292650a95f0
|
|
4
|
+
data.tar.gz: 3a0d4e1cc70b21d2cd6784c107e373541016728d5c05680bee6eca6831a5964f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9d170db8ea667b1d17973c7d5f732daf505acae8e8532b89635c65226d673d23c970f18e368d76853027aa7d078c8c5963b0b98daf6fad16b6e68ccdeaed1e1
|
|
7
|
+
data.tar.gz: fe35e3471d8db66d5799e75d16f6f52e781dd9ec85c5a955bca6aef562ba2978760411ee55779d4c2fb170b430f22b53319a5023349d6e26558eb238ba2d642d
|
data/CHANGELOG.md
CHANGED
|
@@ -117,6 +117,19 @@ relax the core version constraint. Applications using
|
|
|
117
117
|
`appium_console` or `appium_capybara` through `appium_lib` should upgrade with that
|
|
118
118
|
compatible release. Direct users of `appium_lib_core` can migrate as described above.
|
|
119
119
|
|
|
120
|
+
## [14.1.0](https://github.com/appium/ruby_lib_core/compare/v14.0.0...v14.1.0) (2026-11-24)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Features
|
|
124
|
+
|
|
125
|
+
* open the BiDi WebSocket in Base::Bridge and deprecate Base::BiDiBridge ([#741](https://github.com/appium/ruby_lib_core/issues/741)) ([725f6fb](https://github.com/appium/ruby_lib_core/commit/725f6fb853a815865ddb1d4c7692a22791d7a150))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
### Bug Fixes
|
|
129
|
+
|
|
130
|
+
* fix & and add test code ([#743](https://github.com/appium/ruby_lib_core/issues/743)) ([ddfa257](https://github.com/appium/ruby_lib_core/commit/ddfa25737ce775cc8a906ed81350ec2bceabbf1f))
|
|
131
|
+
* rubocop ([#744](https://github.com/appium/ruby_lib_core/issues/744)) ([3d1c58b](https://github.com/appium/ruby_lib_core/commit/3d1c58b19d7bea016094fd85b0eda5ecd8256bec))
|
|
132
|
+
|
|
120
133
|
## [14.0.0](https://github.com/appium/ruby_lib_core/compare/v13.2.1...v14.0.0) (2026-11-16)
|
|
121
134
|
|
|
122
135
|
|
|
@@ -124,6 +124,46 @@ module Appium
|
|
|
124
124
|
raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload' unless @session_id
|
|
125
125
|
|
|
126
126
|
@capabilities = json_create(response['capabilities'])
|
|
127
|
+
connect_bidi
|
|
128
|
+
@capabilities
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Override
|
|
132
|
+
# The BiDi connection opened when the session returned a +webSocketUrl+.
|
|
133
|
+
#
|
|
134
|
+
# @return [::Selenium::WebDriver::BiDi]
|
|
135
|
+
# @raise [::Selenium::WebDriver::Error::WebDriverError] If the session has no BiDi connection.
|
|
136
|
+
def bidi
|
|
137
|
+
@bidi || raise(::Selenium::WebDriver::Error::WebDriverError,
|
|
138
|
+
'BiDi must be enabled by providing webSocketUrl capability to true')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Override
|
|
142
|
+
# The BiDi WebSocket, which Selenium's generated +BiDi::Protocol+ classes use when given a driver.
|
|
143
|
+
# Needs selenium-webdriver 4.46 or newer, where those classes were added.
|
|
144
|
+
#
|
|
145
|
+
# @return [::Selenium::WebDriver::WebSocketConnection]
|
|
146
|
+
# @raise [::Selenium::WebDriver::Error::WebDriverError] If the session has no BiDi connection.
|
|
147
|
+
#
|
|
148
|
+
# @example
|
|
149
|
+
#
|
|
150
|
+
# require 'selenium/webdriver/bidi/protocol'
|
|
151
|
+
# ::Selenium::WebDriver::BiDi::Protocol::Session.new(driver).status
|
|
152
|
+
#
|
|
153
|
+
def connection
|
|
154
|
+
bidi.ws # steep:ignore
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Override
|
|
158
|
+
def quit
|
|
159
|
+
super
|
|
160
|
+
ensure
|
|
161
|
+
@bidi&.close
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Override
|
|
165
|
+
def close
|
|
166
|
+
execute(:close_window).tap { |handles| @bidi&.close if handles && handles.empty? }
|
|
127
167
|
end
|
|
128
168
|
|
|
129
169
|
# Append +appium:+ prefix for Appium following W3C spec
|
|
@@ -148,6 +188,21 @@ module Appium
|
|
|
148
188
|
|
|
149
189
|
private
|
|
150
190
|
|
|
191
|
+
def connect_bidi
|
|
192
|
+
url = @capabilities[:web_socket_url]
|
|
193
|
+
return unless url.is_a?(String) && url.start_with?('ws://', 'wss://')
|
|
194
|
+
|
|
195
|
+
@bidi = ::Selenium::WebDriver::BiDi.new(url: url) # steep:ignore
|
|
196
|
+
rescue StandardError => e
|
|
197
|
+
::Appium::Logger.warn "WebSocket connection to #{url} for BiDi failed. Deleting the session. Error: #{e}"
|
|
198
|
+
begin
|
|
199
|
+
quit
|
|
200
|
+
rescue StandardError => quit_error
|
|
201
|
+
::Appium::Logger.warn "Deleting the session failed. Error: #{quit_error}"
|
|
202
|
+
end
|
|
203
|
+
raise
|
|
204
|
+
end
|
|
205
|
+
|
|
151
206
|
# Preserve the response until Element initialization, including for script results.
|
|
152
207
|
# Selenium calls this immediately before constructing an element. Keep nil for
|
|
153
208
|
# non-element hashes so ordinary script results and shadow roots stay intact.
|
|
@@ -326,6 +381,15 @@ module Appium
|
|
|
326
381
|
execute :chrome_send_command, {}, command_params
|
|
327
382
|
end
|
|
328
383
|
end # class Bridge
|
|
384
|
+
|
|
385
|
+
# Resolving the deprecated BiDiBridge alias here, instead of assigning a constant, logs a warning on each use.
|
|
386
|
+
def self.const_missing(name)
|
|
387
|
+
return super unless name == :BiDiBridge
|
|
388
|
+
|
|
389
|
+
::Appium::Logger.warn '[DEPRECATION] Appium::Core::Base::BiDiBridge is deprecated. ' \
|
|
390
|
+
'Please use Appium::Core::Base::Bridge instead'
|
|
391
|
+
Bridge
|
|
392
|
+
end
|
|
329
393
|
end # class Base
|
|
330
394
|
end # module Core
|
|
331
395
|
end # module Appium
|
|
@@ -56,9 +56,6 @@ module Appium
|
|
|
56
56
|
@devtools = nil
|
|
57
57
|
@bidi = nil
|
|
58
58
|
|
|
59
|
-
# internal use
|
|
60
|
-
@has_bidi = false
|
|
61
|
-
|
|
62
59
|
# steep:ignore:start
|
|
63
60
|
::Selenium::WebDriver::Remote::Bridge.element_class = ::Appium::Core::Element
|
|
64
61
|
# steep:ignore:end
|
|
@@ -86,10 +83,8 @@ module Appium
|
|
|
86
83
|
|
|
87
84
|
raise ::Appium::Core::Error::ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
|
|
88
85
|
|
|
89
|
-
@has_bidi = capabilities && (capabilities['webSocketUrl'] || capabilities[:webSocketUrl]) ? true : false
|
|
90
|
-
bridge_clzz = @has_bidi ? ::Appium::Core::Base::BiDiBridge : ::Appium::Core::Base::Bridge
|
|
91
86
|
# steep:ignore:start
|
|
92
|
-
bridge =
|
|
87
|
+
bridge = ::Appium::Core::Base::Bridge.new(**bridge_opts)
|
|
93
88
|
bridge.extend(bridge_extensions) if bridge_extensions
|
|
94
89
|
# steep:ignore:end
|
|
95
90
|
|
|
@@ -1030,8 +1025,11 @@ module Appium
|
|
|
1030
1025
|
@bridge.convert_to_element response_id
|
|
1031
1026
|
end
|
|
1032
1027
|
|
|
1033
|
-
# Return
|
|
1028
|
+
# Return BiDi instance for the session's WebSocket connection.
|
|
1029
|
+
# The session has one when the server returned a +webSocketUrl+ for a +webSocketUrl: true+ capability.
|
|
1030
|
+
#
|
|
1034
1031
|
# @return [::Selenium::WebDriver::BiDi]
|
|
1032
|
+
# @raise [::Selenium::WebDriver::Error::WebDriverError] If the session has no BiDi connection.
|
|
1035
1033
|
#
|
|
1036
1034
|
# @example
|
|
1037
1035
|
#
|
|
@@ -1046,10 +1044,7 @@ module Appium
|
|
|
1046
1044
|
# driver.bidi.send_cmd('session.unsubscribe', 'events': ['log.entryAdded'], 'contexts': ['NATIVE_APP'])
|
|
1047
1045
|
#
|
|
1048
1046
|
def bidi
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
msg = 'BiDi must be enabled by providing webSocketUrl capability to true'
|
|
1052
|
-
raise(::Selenium::WebDriver::Error::WebDriverError, msg)
|
|
1047
|
+
@bridge.bidi
|
|
1053
1048
|
end
|
|
1054
1049
|
end # class Driver
|
|
1055
1050
|
end # class Base
|
|
@@ -31,7 +31,6 @@ require_relative 'device/orientation'
|
|
|
31
31
|
|
|
32
32
|
# The following files have selenium-webdriver related stuff.
|
|
33
33
|
require_relative 'base/bridge'
|
|
34
|
-
require_relative 'base/bidi_bridge'
|
|
35
34
|
require_relative 'base/driver'
|
|
36
35
|
require_relative 'base/capabilities'
|
|
37
36
|
require_relative 'base/http_default'
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module Appium
|
|
16
16
|
module Core
|
|
17
|
-
VERSION = '14.
|
|
18
|
-
DATE = '2026-11-
|
|
17
|
+
VERSION = '14.1.0' unless defined? ::Appium::Core::VERSION
|
|
18
|
+
DATE = '2026-11-24' unless defined? ::Appium::Core::DATE # x-release-please-date
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -15,6 +15,8 @@ module Appium
|
|
|
15
15
|
# generate a dummy capabilities instance which only has the given platformName and automationName
|
|
16
16
|
@capabilities: untyped
|
|
17
17
|
|
|
18
|
+
@bidi: untyped
|
|
19
|
+
|
|
18
20
|
include Device::DeviceLock
|
|
19
21
|
|
|
20
22
|
include Device::Keyboard
|
|
@@ -96,6 +98,14 @@ module Appium
|
|
|
96
98
|
#
|
|
97
99
|
def create_session: (untyped capabilities) -> ::Appium::Core::Base::Capabilities
|
|
98
100
|
|
|
101
|
+
def bidi: () -> ::Selenium::WebDriver::BiDi
|
|
102
|
+
|
|
103
|
+
def connection: () -> untyped
|
|
104
|
+
|
|
105
|
+
def quit: () -> untyped
|
|
106
|
+
|
|
107
|
+
def close: () -> untyped
|
|
108
|
+
|
|
99
109
|
# Append +appium:+ prefix for Appium following W3C spec
|
|
100
110
|
# https://www.w3.org/TR/webdriver/#dfn-validate-capabilities
|
|
101
111
|
#
|
|
@@ -105,6 +115,8 @@ module Appium
|
|
|
105
115
|
|
|
106
116
|
private
|
|
107
117
|
|
|
118
|
+
def connect_bidi: () -> untyped
|
|
119
|
+
|
|
108
120
|
def element_id_from: (untyped response) -> untyped
|
|
109
121
|
|
|
110
122
|
def selenium_bridge_accepts_url?: () -> bool
|
|
@@ -207,6 +219,11 @@ module Appium
|
|
|
207
219
|
# So this bridge itself does not restrict the target module.
|
|
208
220
|
def send_command: (untyped command_params) -> untyped
|
|
209
221
|
end
|
|
222
|
+
|
|
223
|
+
# @deprecated Use Bridge
|
|
224
|
+
class BiDiBridge = Bridge
|
|
225
|
+
|
|
226
|
+
def self.const_missing: (Symbol name) -> untyped
|
|
210
227
|
end
|
|
211
228
|
end
|
|
212
229
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appium_lib_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 14.
|
|
4
|
+
version: 14.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kazuaki MATSUO
|
|
@@ -52,7 +52,6 @@ files:
|
|
|
52
52
|
- lib/appium_lib_core/android_uiautomator2.rb
|
|
53
53
|
- lib/appium_lib_core/common.rb
|
|
54
54
|
- lib/appium_lib_core/common/base.rb
|
|
55
|
-
- lib/appium_lib_core/common/base/bidi_bridge.rb
|
|
56
55
|
- lib/appium_lib_core/common/base/bridge.rb
|
|
57
56
|
- lib/appium_lib_core/common/base/capabilities.rb
|
|
58
57
|
- lib/appium_lib_core/common/base/device_ime.rb
|
|
@@ -172,7 +171,6 @@ files:
|
|
|
172
171
|
- sig/lib/appium_lib_core/android_uiautomator2.rbs
|
|
173
172
|
- sig/lib/appium_lib_core/common.rbs
|
|
174
173
|
- sig/lib/appium_lib_core/common/base.rbs
|
|
175
|
-
- sig/lib/appium_lib_core/common/base/bidi_bridge.rbs
|
|
176
174
|
- sig/lib/appium_lib_core/common/base/bridge.rbs
|
|
177
175
|
- sig/lib/appium_lib_core/common/base/capabilities.rbs
|
|
178
176
|
- sig/lib/appium_lib_core/common/base/device_ime.rbs
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
require_relative 'bridge'
|
|
16
|
-
|
|
17
|
-
module Appium
|
|
18
|
-
module Core
|
|
19
|
-
class Base
|
|
20
|
-
class BiDiBridge < ::Appium::Core::Base::Bridge
|
|
21
|
-
# steep:ignore:start
|
|
22
|
-
|
|
23
|
-
attr_reader :bidi
|
|
24
|
-
|
|
25
|
-
# Override
|
|
26
|
-
# Creates session handling.
|
|
27
|
-
#
|
|
28
|
-
# @param [::Appium::Core::Base::Capabilities, Hash] capabilities A capability
|
|
29
|
-
# @return [::Appium::Core::Base::Capabilities]
|
|
30
|
-
#
|
|
31
|
-
# @example
|
|
32
|
-
#
|
|
33
|
-
# opts = {
|
|
34
|
-
# caps: {
|
|
35
|
-
# platformName: :android,
|
|
36
|
-
# automationName: 'uiautomator2',
|
|
37
|
-
# platformVersion: '15',
|
|
38
|
-
# deviceName: 'Android',
|
|
39
|
-
# webSocketUrl: true,
|
|
40
|
-
# },
|
|
41
|
-
# appium_lib: {
|
|
42
|
-
# wait_timeout: 30
|
|
43
|
-
# }
|
|
44
|
-
# }
|
|
45
|
-
# core = ::Appium::Core.for(caps)
|
|
46
|
-
# driver = core.start_driver
|
|
47
|
-
#
|
|
48
|
-
def create_session(capabilities)
|
|
49
|
-
super
|
|
50
|
-
|
|
51
|
-
return @capabilities if @capabilities.nil?
|
|
52
|
-
|
|
53
|
-
begin
|
|
54
|
-
socket_url = @capabilities[:web_socket_url]
|
|
55
|
-
@bidi = ::Selenium::WebDriver::BiDi.new(url: socket_url) if socket_url
|
|
56
|
-
rescue StandardError => e
|
|
57
|
-
::Appium::Logger.warn "WebSocket connection to #{socket_url} for BiDi failed. Error #{e}"
|
|
58
|
-
raise
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
@capabilities
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def get(url)
|
|
65
|
-
browsing_context.navigate(url)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def go_back
|
|
69
|
-
browsing_context.traverse_history(-1)
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def go_forward
|
|
73
|
-
browsing_context.traverse_history(1)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def refresh
|
|
77
|
-
browsing_context.reload
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def quit
|
|
81
|
-
super
|
|
82
|
-
ensure
|
|
83
|
-
bidi&.close
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def close
|
|
87
|
-
execute(:close_window).tap { |handles| bidi&.close if handles.empty? }
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
# steep:ignore:end
|
|
91
|
-
|
|
92
|
-
private
|
|
93
|
-
|
|
94
|
-
def browsing_context
|
|
95
|
-
@browsing_context ||= ::Selenium::WebDriver::BiDi::BrowsingContext.new(self)
|
|
96
|
-
end
|
|
97
|
-
end # class BiDiBridge
|
|
98
|
-
end # class Base
|
|
99
|
-
end # module Core
|
|
100
|
-
end # module Appium
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module Appium
|
|
2
|
-
module Core
|
|
3
|
-
class Base
|
|
4
|
-
class BiDiBridge < ::Appium::Core::Base::Bridge
|
|
5
|
-
@bidi: ::Selenium::WebDriver::BiDi
|
|
6
|
-
|
|
7
|
-
def attach_to: (untyped session_id, untyped platform_name, untyped automation_name) -> untyped
|
|
8
|
-
|
|
9
|
-
def create_session: (untyped capabilities) -> ::Appium::Core::Base::Capabilities
|
|
10
|
-
|
|
11
|
-
def get: (string url) -> untyped
|
|
12
|
-
|
|
13
|
-
def go_back: () -> untyped
|
|
14
|
-
|
|
15
|
-
def go_forward: () -> untyped
|
|
16
|
-
|
|
17
|
-
def refresh: () -> untyped
|
|
18
|
-
|
|
19
|
-
def quit: () -> untyped
|
|
20
|
-
|
|
21
|
-
def close: () -> untyped
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def browsing_context: () -> ::Selenium::WebDriver::BiDi::BrowsingContext
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|