appium_lib_core 11.0.2 → 11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d726486fec10984535bedbd31b2d24a7891a7d10ba31f06f823307678ac0bc6
4
- data.tar.gz: 8de3869f41fa4f680e8db592d26287430bdb68b9a79f757baeb6018afbeac80f
3
+ metadata.gz: 701a3cbc303b81ada16130a28d1a4d2a42f96547b474cb612ef7d64e221fa1c9
4
+ data.tar.gz: 6af95a9abdb55ba70a678b007dae0d1f2a585140e80ffc19c90f7e271f88de19
5
5
  SHA512:
6
- metadata.gz: e98f8d19e9e09abc6ee28f1be39e9d22d41dceabc57cc936594adda74df1a699a100059c242787bba4c0ea331a6681257f171ab8e397cf890631463692d4d655
7
- data.tar.gz: 7b80fe220f197d16a45ecc6cc83495388efd1261a90c2597ca0651666b885dbeccf9fe4809f46e19fad47361113f0f0fd3ea267df8fe8c65c437e4feff8a3ba5
6
+ metadata.gz: d0368fce9366a63d848c6ea3cea893a2df6a0a43a9d8b747affd0da66cd52a127a187df4f037ed628a055e010d7616f061a664df9a17f39971619ba13babf89b
7
+ data.tar.gz: b654930fcfb681003d8163c8ed7aed461b7633799e26c70bd9499fbbc336927ca9f87bf25254c1188960e88eade1370460557a83802a1799509de9c3e78144b5
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  Read `release_notes.md` for commit level details.
4
4
 
5
+ ## [11.1.0] - 2025-08-08
6
+ - Add WebDriver BiDi support. Please set `webSocketUrl` in the capabilities to enable it.
7
+ - `test/functional/android/webdriver/bidi_test.rb` can be an example usage.
8
+ - Older versions of the Selenium Ruby bindings may raise exceptions due to missing dependencies.
9
+
5
10
  ## [11.0.2] - 2025-04-27
6
11
  - Add more sig definitions [#571](https://github.com/appium/ruby_lib_core/pull/571)
7
12
 
data/Gemfile CHANGED
@@ -8,7 +8,7 @@ gem 'minitest', '~> 5.0'
8
8
  gem 'minitest-reporters', '~> 1.1'
9
9
  gem 'parallel_tests'
10
10
  gem 'rake', '~> 13.0'
11
- gem 'rubocop', '1.75.3'
11
+ gem 'rubocop', '1.79.2'
12
12
  gem 'simplecov'
13
13
  gem 'steep', '~> 1.9.3'
14
14
  gem 'webmock', '~> 3.25.0'
data/README.md CHANGED
@@ -114,8 +114,8 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
114
114
  opts = {
115
115
  capabilities: { # Append capabilities
116
116
  platformName: 'ios',
117
- platformVersion: '11.0',
118
- deviceName: 'iPhone Simulator',
117
+ platformVersion: '18.4',
118
+ deviceName: 'iPhone 16 Plus',
119
119
  # app: '/path/to/MyiOS.app', # Without 'app' capability, an appium session starts with the home screen
120
120
  automationName: 'XCUITest'
121
121
  },
@@ -138,7 +138,7 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
138
138
  $ ruby test.rb
139
139
  ```
140
140
 
141
- [Appium::Core.for](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver#for-class_method) documentation has more example to build a new driver instance.
141
+ [Appium::Core.for](https://rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver#for-class_method) documentation has more example to build a new driver instance.
142
142
 
143
143
  More examples are in [test/functional](test/functional)
144
144
 
@@ -153,9 +153,29 @@ attached_driver.page_source
153
153
 
154
154
  ### Capabilities
155
155
 
156
- Read [Appium/Core/Driver](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
157
- Capabilities affect only ruby_lib is [Appium/Core/Options](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Options).
156
+ Read [Appium/Core/Driver](https://rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Driver) to catch up with available capabilities.
157
+ Capabilities affect only ruby_lib is [Appium/Core/Options](https://rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Options).
158
158
 
159
+ ### Improvement ideas
160
+
161
+ - for iOS
162
+
163
+ ```
164
+ $ appium driver run xcuitest download-wda-sim --outdir=/path/to/download/prebuilt/wda/
165
+ ```
166
+
167
+ Then, adding capabilities below:
168
+
169
+ ```json
170
+ {
171
+ "appium:usePreinstalledWDA": true,
172
+ "appium:prebuiltWDAPath": "/path/to/download/prebuilt/wda/WebDriverAgentRunner-Runner.app"
173
+ }
174
+ ```
175
+
176
+ It will improve initial new session request performance for iOS simulator.
177
+
178
+ `"appium:settings[respectSystemAlerts]" => true` for capability will also help to work with [permissions](https://appium.github.io/appium-xcuitest-driver/latest/guides/troubleshooting/#interact-with-dialogs-managed-by-comapplespringboard).
159
179
 
160
180
  ### Gives custom listener
161
181
 
@@ -171,7 +191,7 @@ capabilities: {
171
191
  deviceName: 'iPhone Simulator',
172
192
  automationName: 'XCUITest',
173
193
  app: '/path/to/MyiOS.app'
174
- },
194
+ }
175
195
  appium_lib: {
176
196
  listener: CustomListener.new
177
197
  }
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.add_dependency 'faye-websocket', '~> 0.11.0'
24
+ spec.add_dependency 'faye-websocket', '>= 0.11', '< 0.13'
25
25
  spec.add_dependency 'selenium-webdriver', '~> 4.21'
26
26
 
27
27
  spec.metadata['rubygems_mfa_required'] = 'true'
@@ -0,0 +1,96 @@
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
+ attr_reader :bidi
22
+
23
+ # Override
24
+ # Creates session handling.
25
+ #
26
+ # @param [::Appium::Core::Base::Capabilities, Hash] capabilities A capability
27
+ # @return [::Appium::Core::Base::Capabilities]
28
+ #
29
+ # @example
30
+ #
31
+ # opts = {
32
+ # caps: {
33
+ # platformName: :android,
34
+ # automationName: 'uiautomator2',
35
+ # platformVersion: '15',
36
+ # deviceName: 'Android',
37
+ # webSocketUrl: true,
38
+ # },
39
+ # appium_lib: {
40
+ # wait: 30
41
+ # }
42
+ # }
43
+ # core = ::Appium::Core.for(caps)
44
+ # driver = core.start_driver
45
+ #
46
+ def create_session(capabilities)
47
+ super
48
+
49
+ return @capabilities if @capabilities.nil?
50
+
51
+ begin
52
+ socket_url = @capabilities[:web_socket_url]
53
+ @bidi = ::Selenium::WebDriver::BiDi.new(url: socket_url) if socket_url
54
+ rescue StandardError => e
55
+ ::Appium::Logger.warn "WebSocket connection to #{socket_url} for BiDi failed. Error #{e}"
56
+ raise
57
+ end
58
+
59
+ @capabilities
60
+ end
61
+
62
+ def get(url)
63
+ browsing_context.navigate(url)
64
+ end
65
+
66
+ def go_back
67
+ browsing_context.traverse_history(-1)
68
+ end
69
+
70
+ def go_forward
71
+ browsing_context.traverse_history(1)
72
+ end
73
+
74
+ def refresh
75
+ browsing_context.reload
76
+ end
77
+
78
+ def quit
79
+ super
80
+ ensure
81
+ bidi.close
82
+ end
83
+
84
+ def close
85
+ execute(:close_window).tap { |handles| bidi.close if handles.empty? }
86
+ end
87
+
88
+ private
89
+
90
+ def browsing_context
91
+ @browsing_context ||= ::Selenium::WebDriver::BiDi::BrowsingContext.new(self)
92
+ end
93
+ end # class BiDiBridge
94
+ end # class Base
95
+ end # module Core
96
+ end # module Appium
@@ -54,7 +54,9 @@ module Appium
54
54
  @devtools = nil
55
55
  @bidi = nil
56
56
 
57
- # in the selenium webdriver as well
57
+ # internal use
58
+ @has_bidi = false
59
+
58
60
  ::Selenium::WebDriver::Remote::Bridge.element_class = ::Appium::Core::Element
59
61
  bridge ||= create_bridge(**opts)
60
62
  add_extensions(bridge.browser)
@@ -79,7 +81,9 @@ module Appium
79
81
 
80
82
  raise ::Appium::Core::Error::ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
81
83
 
82
- bridge = ::Appium::Core::Base::Bridge.new(**bridge_opts)
84
+ @has_bidi = !!(capabilities && capabilities['webSocketUrl'])
85
+ bridge_clzz = @has_bidi ? ::Appium::Core::Base::BiDiBridge : ::Appium::Core::Base::Bridge
86
+ bridge = bridge_clzz.new(**bridge_opts)
83
87
 
84
88
  if session_id.nil?
85
89
  bridge.create_session(capabilities)
@@ -996,6 +1000,28 @@ module Appium
996
1000
  def convert_to_element(response_id)
997
1001
  @bridge.convert_to_element response_id
998
1002
  end
1003
+
1004
+ # Return bidi instance
1005
+ # @return [::Selenium::WebDriver::BiDi]
1006
+ #
1007
+ # @example
1008
+ #
1009
+ # log_entries = []
1010
+ # driver.bidi.send_cmd('session.subscribe', 'events': ['log.entryAdded'], 'contexts': ['NATIVE_APP'])
1011
+ # subscribe_id = driver.bidi.add_callback('log.entryAdded') do |params|
1012
+ # log_entries << params
1013
+ # end
1014
+ # driver.page_source
1015
+ #
1016
+ # driver.bidi.remove_callback('log.entryAdded', subscribe_id)
1017
+ # driver.bidi.send_cmd('session.unsubscribe', 'events': ['log.entryAdded'], 'contexts': ['NATIVE_APP'])
1018
+ #
1019
+ def bidi
1020
+ return @bridge.bidi if @has_bidi
1021
+
1022
+ msg = 'BiDi must be enabled by providing webSocketUrl capability to true'
1023
+ raise(::Selenium::WebDriver::Error::WebDriverError, msg)
1024
+ end
999
1025
  end # class Driver
1000
1026
  end # class Base
1001
1027
  end # module Core
@@ -30,8 +30,9 @@ require_relative 'device/execute_driver'
30
30
  require_relative 'device/orientation'
31
31
 
32
32
  # The following files have selenium-webdriver related stuff.
33
- require_relative 'base/driver'
34
33
  require_relative 'base/bridge'
34
+ require_relative 'base/bidi_bridge'
35
+ require_relative 'base/driver'
35
36
  require_relative 'base/capabilities'
36
37
  require_relative 'base/http_default'
37
38
  require_relative 'base/search_context'
@@ -25,7 +25,7 @@ module Appium
25
25
  execute_script 'mobile:hideKeyboard', option
26
26
  end
27
27
 
28
- def is_keyboard_shown # rubocop:disable Naming/PredicateName
28
+ def is_keyboard_shown # rubocop:disable Naming/PredicatePrefix
29
29
  execute_script 'mobile:isKeyboardShown', {}
30
30
  end
31
31
  end # module Keyboard
@@ -421,8 +421,8 @@ module Appium
421
421
  d_c = DirectConnections.new(@driver.capabilities)
422
422
  @driver.update_sending_request_to(protocol: d_c.protocol, host: d_c.host, port: d_c.port, path: d_c.path)
423
423
  end
424
- rescue Errno::ECONNREFUSED
425
- raise "ERROR: Unable to connect to Appium. Is the server running on #{@custom_url}?"
424
+ rescue Errno::ECONNREFUSED => e
425
+ raise "ERROR: Unable to connect to Appium. Is the server running on #{@custom_url}? Error: #{e}"
426
426
  end
427
427
 
428
428
  if @http_client.instance_variable_defined? :@additional_headers
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '11.0.2' unless defined? ::Appium::Core::VERSION
18
- DATE = '2025-04-27' unless defined? ::Appium::Core::DATE
17
+ VERSION = '11.1.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2025-08-08' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -0,0 +1,25 @@
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
+ end
23
+ end
24
+ end
25
+ end
@@ -94,7 +94,7 @@ module Appium
94
94
  # core = ::Appium::Core.for(caps)
95
95
  # driver = core.start_driver
96
96
  #
97
- def create_session: (untyped capabilities) -> untyped
97
+ def create_session: (untyped capabilities) -> ::Appium::Core::Base::Capabilities
98
98
 
99
99
  # Append +appium:+ prefix for Appium following W3C spec
100
100
  # https://www.w3.org/TR/webdriver/#dfn-validate-capabilities
@@ -1 +1,9 @@
1
- APPIUM_EXTRA_FINDERS: { accessibility_id: "accessibility id", image: "-image", custom: "-custom", uiautomator: "-android uiautomator", viewtag: "-android viewtag", data_matcher: "-android datamatcher", view_matcher: "-android viewmatcher", predicate: "-ios predicate string", class_chain: "-ios class chain" }
1
+ module Appium
2
+ module Core
3
+ class Base
4
+ module SearchContext
5
+ APPIUM_EXTRA_FINDERS: { Symbol => String }
6
+ end
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.2
4
+ version: 11.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-28 00:00:00.000000000 Z
11
+ date: 2025-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.11'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 0.11.0
22
+ version: '0.13'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '0.11'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 0.11.0
32
+ version: '0.13'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: selenium-webdriver
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -72,6 +78,7 @@ files:
72
78
  - lib/appium_lib_core/android_uiautomator2.rb
73
79
  - lib/appium_lib_core/common.rb
74
80
  - lib/appium_lib_core/common/base.rb
81
+ - lib/appium_lib_core/common/base/bidi_bridge.rb
75
82
  - lib/appium_lib_core/common/base/bridge.rb
76
83
  - lib/appium_lib_core/common/base/capabilities.rb
77
84
  - lib/appium_lib_core/common/base/device_ime.rb
@@ -187,6 +194,7 @@ files:
187
194
  - sig/lib/appium_lib_core/android/uiautomator1/bridge.rbs
188
195
  - sig/lib/appium_lib_core/android/uiautomator2/bridge.rbs
189
196
  - sig/lib/appium_lib_core/android/uiautomator2/device/battery.rbs
197
+ - sig/lib/appium_lib_core/common/base/bidi_bridge.rbs
190
198
  - sig/lib/appium_lib_core/common/base/bridge.rbs
191
199
  - sig/lib/appium_lib_core/common/base/capabilities.rbs
192
200
  - sig/lib/appium_lib_core/common/base/device_ime.rbs