appium_lib_core 9.5.2 → 11.0.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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -4
  3. data/Gemfile +2 -2
  4. data/README.md +2 -2
  5. data/lib/appium_lib_core/android/device/auth_finger_print.rb +1 -4
  6. data/lib/appium_lib_core/android/device/clipboard.rb +2 -2
  7. data/lib/appium_lib_core/android/device/emulator.rb +7 -8
  8. data/lib/appium_lib_core/android/device/performance.rb +3 -7
  9. data/lib/appium_lib_core/android/device/screen.rb +1 -3
  10. data/lib/appium_lib_core/android/device.rb +12 -184
  11. data/lib/appium_lib_core/common/base/bridge.rb +1 -15
  12. data/lib/appium_lib_core/common/base/driver.rb +6 -34
  13. data/lib/appium_lib_core/common/command.rb +1 -45
  14. data/lib/appium_lib_core/common/device/app_management.rb +1 -1
  15. data/lib/appium_lib_core/common/device/app_state.rb +2 -2
  16. data/lib/appium_lib_core/common/device/device.rb +3 -2
  17. data/lib/appium_lib_core/common/device/device_lock.rb +3 -3
  18. data/lib/appium_lib_core/common/device/keyboard.rb +4 -5
  19. data/lib/appium_lib_core/common/device/keyevent.rb +3 -3
  20. data/lib/appium_lib_core/common/log.rb +4 -4
  21. data/lib/appium_lib_core/common/ws/websocket.rb +1 -1
  22. data/lib/appium_lib_core/driver.rb +12 -12
  23. data/lib/appium_lib_core/ios/device/clipboard.rb +2 -2
  24. data/lib/appium_lib_core/ios/device.rb +2 -2
  25. data/lib/appium_lib_core/ios/xcuitest/device.rb +4 -13
  26. data/lib/appium_lib_core/version.rb +2 -2
  27. data/sig/lib/appium_lib_core/common/base/driver.rbs +1 -3
  28. metadata +3 -6
  29. data/lib/appium_lib_core/android/device/network.rb +0 -71
  30. data/lib/appium_lib_core/common/base/has_network_connection.rb +0 -56
  31. data/sig/lib/appium_lib_core/common/base/has_network_connection.rbs +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed3c50c78d8ac4e95f6e7b7a0c837d638b263595cdcfd1e59c73fa7b71eeb70b
4
- data.tar.gz: f0f79ecc0cd874377b1c9ff35fb3b0bc1d9f7bd65b26aa8eb60b99583d6cf7f7
3
+ metadata.gz: '096a1bfdfebe6fe9d6e889ed22981092379ec2431c0559420936f73d7735e37b'
4
+ data.tar.gz: b56f5eb3c67bb2846821d78da6f46b728d4fb878307cdb70a8480d054e102dbf
5
5
  SHA512:
6
- metadata.gz: ea9d481550f2bd11e1df240e9d0c1f76c65a4b5465e4d490450a60facaf1cfcdf8c92a7387a71391ab89fb648a8229f3476a124f74607a207caef44b95350500
7
- data.tar.gz: 8d9991dccc182a06445f0708af1d76d0ad6f044e0623d8ef521e254869a46b81e625ac68eb133171d5be56465ec8cf6cf4e135a8dc010f59e8b03b90f71e6e00
6
+ metadata.gz: e969dea1a82fad771660c1f60a7dbff44a6c12678f5bba7f268396f3e8d7c1b086c8d285e7d4a32195aab9b5971e49764d86767758b465016d4e8d9ec687cf16
7
+ data.tar.gz: 7c5d0a6173832ed2e6e6a6147084a6150cbf7e1c2347120a0b6798756bf63deb970e08e223c7f003fb1ede3478aa14e87c5e5b4d623eb33e51003e72298d2edd
data/CHANGELOG.md CHANGED
@@ -2,13 +2,21 @@
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
- ## [Unreleased]
6
-
5
+ ## [11.0.0] - 2025-03-21
7
6
  ### Enhancements
7
+ - Remove deprecated marked commands
8
+ - `get_network_connection` / `set_network_connection`, `toggle_wifi`, `toggle_data`, `toggle_airplane_mode`
9
+ - Please use `mobile: setConnectivity` / `mobile: getConnectivity` instead
10
+ - `start_activity`
11
+ - Please use `mobile: startActivity` instead
12
+ - Use mobile command for existing methods (the backend method call has changed. Old appium such as Appium v1 or before may have an issue as no matched command)
13
+ - `toggle_location_services`, `get_performance_data`, `get_performance_data_types`, `finger_print`, `open_notifications`, `current_activity`, `current_package`, `get_system_bars`, `system_bars`, `toggle_location_services`, `hide_keyboard`, `background_app`, `set_clipboard`, `get_clipboard`, `send_sms`, `gsm_call`, `gsm_signal`, `gsm_voice`, `set_network_speed`, `set_power_capacity`, `set_power_ac`, `get_display_density`, `lock`, `unlock`, `locked?`, `hide_keyboard`, `press_keycode`, `long_press_keycode`, `app_strings`, `app_state`, `shake`, `device_time`
8
14
 
9
- ### Bug fixes
15
+ ## [10.0.0] - 2025-02-16
10
16
 
11
- ### Deprecations
17
+ ### Enhancements
18
+ - Use `http://127.0.0.1:4723` as the default url destination instead of `http://127.0.0.1:4723/wd/hub`
19
+ - `--base-path` in appium server may need to drop the `/wd/hub`
12
20
 
13
21
  ## [9.5.2] - 2025-01-30
14
22
  - Fix yardoc
data/Gemfile CHANGED
@@ -8,8 +8,8 @@ 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.71.0'
11
+ gem 'rubocop', '1.74.0'
12
12
  gem 'simplecov'
13
13
  gem 'steep', '~> 1.9.3'
14
- gem 'webmock', '~> 3.24.0'
14
+ gem 'webmock', '~> 3.25.0'
15
15
  gem 'yard', '~> 0.9.11'
data/README.md CHANGED
@@ -49,7 +49,7 @@ Run functional tests which require the Appium server and real device, Simulator/
49
49
  $ npm install --location=global appium
50
50
  $ appium driver install xcuitest
51
51
  $ appium driver install uiautomator2 # etc
52
- $ appium --base-path=/wd/hub --relaxed-security # To run all tests in local
52
+ $ appium --relaxed-security # To run all tests in local
53
53
  ```
54
54
 
55
55
  - Conduct tests
@@ -146,7 +146,7 @@ As of version 5.8.0, the client can attach to an existing session. The main purp
146
146
 
147
147
  ```ruby
148
148
  # @driver is the driver instance of an existing session
149
- attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'XCUITest', platform_name: 'ios'
149
+ attached_driver = ::Appium::Core::Driver.attach_to @driver.session_id, url: 'http://127.0.0.1:4723', automation_name: 'XCUITest', platform_name: 'ios'
150
150
  assert attached_driver.session_id == @driver.session_id
151
151
  attached_driver.page_source
152
152
  ```
@@ -20,14 +20,11 @@ module Appium
20
20
  def self.add_methods
21
21
  ::Appium::Core::Device.add_endpoint_method(:finger_print) do
22
22
  def finger_print(finger_id)
23
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: fingerprint' extension instead"
24
-
25
23
  unless (1..10).cover? finger_id.to_i
26
24
  raise ::Appium::Core::Error::ArgumentError,
27
25
  "finger_id should be integer between 1 to 10. Not #{finger_id}"
28
26
  end
29
-
30
- execute(:finger_print, {}, { fingerprintId: finger_id.to_i })
27
+ execute_script 'mobile:fingerprint', { fingerprintId: finger_id.to_i }
31
28
  end
32
29
  end
33
30
  end # def self.emulator_commands
@@ -29,7 +29,7 @@ module Appium
29
29
 
30
30
  params = { contentType: content_type }
31
31
 
32
- data = execute(:get_clipboard, {}, params)
32
+ data = execute_script 'mobile:getClipboard', params
33
33
  Base64.decode64 data
34
34
  end
35
35
  end
@@ -47,7 +47,7 @@ module Appium
47
47
  }
48
48
  params[:label] = label unless label.nil?
49
49
 
50
- execute(:set_clipboard, {}, params)
50
+ execute_script 'mobile:setClipboard', params
51
51
  end
52
52
  end
53
53
  end
@@ -115,7 +115,7 @@ module Appium
115
115
  def self.add_methods
116
116
  ::Appium::Core::Device.add_endpoint_method(:send_sms) do
117
117
  def send_sms(phone_number:, message:)
118
- execute(:send_sms, {}, { phoneNumber: phone_number, message: message })
118
+ execute_script 'mobile:sendSms', { phoneNumber: phone_number, message: message }
119
119
  end
120
120
  end
121
121
 
@@ -125,7 +125,7 @@ module Appium
125
125
  raise ::Appium::Core::Error::ArgumentError, "action: should be member of #{GSM_CALL_ACTIONS}. Not #{action}."
126
126
  end
127
127
 
128
- execute(:gsm_call, {}, { phoneNumber: phone_number, action: action })
128
+ execute_script 'mobile:gsmCall', { phoneNumber: phone_number, action: action }
129
129
  end
130
130
  end
131
131
 
@@ -136,8 +136,7 @@ module Appium
136
136
  "#{signal_strength} should be member of #{GSM_SIGNALS.keys} "
137
137
  end
138
138
 
139
- execute(:gsm_signal, {}, { signalStrength: GSM_SIGNALS[signal_strength],
140
- signalStrengh: GSM_SIGNALS[signal_strength] })
139
+ execute_script 'mobile:gsmSignal', { strength: GSM_SIGNALS[signal_strength] }
141
140
  end
142
141
  end
143
142
 
@@ -147,7 +146,7 @@ module Appium
147
146
  raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{GSM_VOICE_STATES}. Not #{state}."
148
147
  end
149
148
 
150
- execute(:gsm_voice, {}, { state: state })
149
+ execute_script 'mobile:gsmVoice', { state: state }
151
150
  end
152
151
  end
153
152
 
@@ -158,7 +157,7 @@ module Appium
158
157
  "The netspeed should be member of #{NET_SPEED}. Not #{netspeed}."
159
158
  end
160
159
 
161
- execute(:set_network_speed, {}, { netspeed: netspeed })
160
+ execute_script 'mobile:networkSpeed', { speed: netspeed }
162
161
  end
163
162
  end
164
163
 
@@ -168,7 +167,7 @@ module Appium
168
167
  ::Appium::Logger.warn "The percent should be between 0 and 100. Not #{percent}."
169
168
  end
170
169
 
171
- execute(:set_power_capacity, {}, { percent: percent })
170
+ execute_script 'mobile:powerCapacity', { percent: percent }
172
171
  end
173
172
  end
174
173
 
@@ -178,7 +177,7 @@ module Appium
178
177
  raise ::Appium::Core::Error::ArgumentError, "The state should be member of #{POWER_AC_STATE}. Not #{state}."
179
178
  end
180
179
 
181
- execute(:set_power_ac, {}, { state: state })
180
+ execute_script 'mobile:powerAc', { state: state }
182
181
  end
183
182
  end
184
183
  end # def self.emulator_commands
@@ -20,17 +20,13 @@ module Appium
20
20
  def self.add_methods
21
21
  ::Appium::Core::Device.add_endpoint_method(:get_performance_data_types) do
22
22
  def get_performance_data_types
23
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getPerformanceDataTypes' extension instead"
24
- execute :get_performance_data_types
23
+ execute_script 'mobile:getPerformanceDataTypes', {}
25
24
  end
26
25
  end
27
26
 
28
27
  ::Appium::Core::Device.add_endpoint_method(:get_performance_data) do
29
- def get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
30
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getPerformanceData' extension instead"
31
-
32
- execute(:get_performance_data, {},
33
- packageName: package_name, dataType: data_type, dataReadTimeout: data_read_timeout)
28
+ def get_performance_data(package_name:, data_type:)
29
+ execute_script 'mobile:getPerformanceData', { packageName: package_name, dataType: data_type }
34
30
  end
35
31
  end
36
32
  end
@@ -20,9 +20,7 @@ module Appium
20
20
  def self.add_methods
21
21
  ::Appium::Core::Device.add_endpoint_method(:get_display_density) do
22
22
  def get_display_density
23
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getDisplayDensity' extension instead"
24
-
25
- execute :get_display_density
23
+ execute_script 'mobile:getDisplayDensity', {}
26
24
  end
27
25
  end
28
26
 
@@ -14,7 +14,6 @@
14
14
 
15
15
  require_relative 'device/emulator'
16
16
  require_relative 'device/clipboard'
17
- require_relative 'device/network'
18
17
  require_relative 'device/performance'
19
18
  require_relative 'device/screen'
20
19
  require_relative 'device/auth_finger_print'
@@ -27,7 +26,6 @@ module Appium
27
26
 
28
27
  # rubocop:disable Layout/LineLength
29
28
 
30
- # @deprecated Use 'mobile: openNotifications' extension instead.
31
29
  # @!method open_notifications
32
30
  # Open Android notifications
33
31
  #
@@ -36,7 +34,6 @@ module Appium
36
34
  # @driver.open_notifications
37
35
  #
38
36
 
39
- # @deprecated Use 'mobile: getCurrentActivity' extension instead.
40
37
  # @!method current_activity
41
38
  # Get current activity name
42
39
  # @return [String] An activity name
@@ -46,7 +43,6 @@ module Appium
46
43
  # @driver.current_activity # '.ApiDemos'
47
44
  #
48
45
 
49
- # @deprecated Use 'mobile: getCurrentPackage' extension instead.
50
46
  # @!method current_package
51
47
  # Get current package name
52
48
  # @return [String] A package name
@@ -56,7 +52,6 @@ module Appium
56
52
  # @driver.current_package # 'com.example.android.apis'
57
53
  #
58
54
 
59
- # @deprecated Use 'mobile: getSystemBars' extension instead.
60
55
  # @!method get_system_bars
61
56
  # Get system bar's information
62
57
  # @return [String]
@@ -67,7 +62,6 @@ module Appium
67
62
  # @driver.system_bars
68
63
  #
69
64
 
70
- # @deprecated Use 'mobile: getDisplayDensity' extension instead.
71
65
  # @!method get_display_density
72
66
  # Get connected device's density.
73
67
  # @return [Integer] The size of density
@@ -77,44 +71,6 @@ module Appium
77
71
  # @driver.get_display_density # 320
78
72
  #
79
73
 
80
- # @deprecated Use 'mobile: getConnectivity' extension instead.
81
- # @!method get_network_connection
82
- # Get the device network connection current status
83
- # See set_network_connection method for return value
84
- # Same as #network_connection_type in selenium-webdriver.
85
- #
86
- # Returns a key of <code>{:airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}</code> in #network_connection_type
87
- # Returns a number of the mode in +#get_network_connection+
88
- #
89
- # @example
90
- #
91
- # @driver.network_connection_type #=> :all
92
- # @driver.get_network_connection #=> 6
93
- #
94
-
95
- # @deprecated Use 'mobile: getConnectivity' extension instead.
96
- # @!method toggle_wifi
97
- # Switch the state of the wifi service only for Android
98
- #
99
- # @return [String]
100
- #
101
- # @example
102
- #
103
- # @driver.toggle_wifi
104
- #
105
-
106
- # @deprecated Use 'mobile: getConnectivity' extension instead.
107
- # @!method toggle_data
108
- # Switch the state of data service only for Android, and the device should be rooted
109
- #
110
- # @return [String]
111
- #
112
- # @example
113
- #
114
- # @driver.toggle_data
115
- #
116
-
117
- # @deprecated Use 'mobile: getConnectivity' extension instead.
118
74
  # @!method location
119
75
  # Get the location of the device.
120
76
  #
@@ -124,7 +80,6 @@ module Appium
124
80
  #
125
81
  # driver.location #=> ::Appium::Location.new(10, 10, 10)
126
82
  #
127
-
128
83
  # @!method location=
129
84
  # Set the [::Appium::Location] of the device.
130
85
  #
@@ -149,7 +104,6 @@ module Appium
149
104
  # driver.set_location 10, 10, 0
150
105
  #
151
106
 
152
- # @deprecated Use 'mobile: toggleGps' extension instead.
153
107
  # @!method toggle_location_services
154
108
  # Switch the state of the location service
155
109
  #
@@ -160,80 +114,17 @@ module Appium
160
114
  # @driver.toggle_location_services
161
115
  #
162
116
 
163
- # @deprecated Use 'mobile: getConnectivity' extension instead.
164
- # @!method toggle_airplane_mode
165
- # Toggle flight mode on or off
166
- #
167
- # @example
168
- #
169
- # @driver.toggle_airplane_mode
170
- #
171
-
172
- # @deprecated Use 'mobile: hideKeyboard' extension instead.
173
- # @!method hide_keyboard(close_key = nil, strategy = nil)
117
+ # @!method hide_keyboard(close_key = nil)
174
118
  # Hide the onscreen keyboard
175
119
  # @param [String] close_key The name of the key which closes the keyboard.
176
120
  # Defaults to 'Done' for iOS(except for XCUITest).
177
- # @param [Symbol] strategy The symbol of the strategy which closes the keyboard.
178
- # XCUITest ignore this argument.
179
- # Default for iOS is +:pressKey+. Default for Android is +:tapOutside+.
180
121
  #
181
122
  # @example
182
123
  #
183
124
  # @driver.hide_keyboard # Close a keyboard with the 'Done' button
184
125
  # @driver.hide_keyboard('Finished') # Close a keyboard with the 'Finished' button
185
- # @driver.hide_keyboard(nil, :tapOutside) # Close a keyboard with tapping out side of keyboard
186
- #
187
-
188
- # @deprecated Use 'mobile: startActivity' extension instead.
189
- # @!method start_activity(opts)
190
- # Android only. Start a new activity within the current app or launch a new app and start the target activity.
191
- #
192
- # Read https://developer.android.com/studio/command-line/adb#IntentSpec for each flags.
193
- #
194
- # @param opts [Hash] Options
195
- # @option opts [String] :app_package The package owning the activity [required]
196
- # @option opts [String] :app_activity The target activity [required]
197
- # @option opts [String] :app_wait_package The package to start before the target package [optional]
198
- # @option opts [String] :app_wait_activity The activity to start before the target activity [optional]
199
- # @option opts [String] :intent_action The intent action to give it when start the target activity (+-a+) [optional]
200
- # @option opts [String] :intent_category The intent category to give it when start the target activity (+-c+) [optional]
201
- # @option opts [String] :intent_flags The intent flag to give it when start the target activity (+-f+) [optional]
202
- # @option opts [String] :optional_intent_arguments The optional intent action to give it when start the target activity [optional]
203
- # You can set arbitrary arguments with space as string.
204
- # e.g. +'--ez your_extra_bool bool --ei your_extra_int 1'+
205
- # @option opts [bool] :dont_stop_app_on_reset Do not stop the app when the reset is called in Appium create/delete session [optional]
206
- #
207
- # @example
208
- #
209
- # start_activity app_package: 'io.appium.android.apis',
210
- # app_activity: '.accessibility.AccessibilityNodeProviderActivity'
211
- #
212
-
213
- # @deprecated Use 'mobile: setConnectivity' extension instead.
214
- # @!method set_network_connection(mode)
215
- # Set the device network connection mode
216
- # Same as +#network_connection_type+ in selenium-webdriver.
217
- #
218
- # @param [String] mode Bit mask that represent the network mode
219
- # Or the key matched with <code>{:airplane_mode: 1, wifi: 2, data: 4, all: 6, none: 0}</code>
220
- #
221
- # Value (Alias) | Data | Wifi | Airplane Mode
222
- # -------------------------------------------------
223
- # 1 (Airplane Mode) | 0 | 0 | 1
224
- # 6 (All network on) | 1 | 1 | 0
225
- # 4 (Data only) | 1 | 0 | 0
226
- # 2 (Wifi only) | 0 | 1 | 0
227
- # 0 (None) | 0 | 0 | 0
228
- #
229
- # @example
230
- #
231
- # @driver.set_network_connection 1
232
- # @driver.set_network_connection :airplane_mode
233
- # @driver.network_connection_type = :airplane_mode # As selenium-webdriver
234
126
  #
235
127
 
236
- # @deprecated Use 'mobile: getPerformanceDataTypes' extension instead.
237
128
  # @!method get_performance_data_types
238
129
  # Get the information type of the system state which is supported to read such as
239
130
  # cpu, memory, network, battery via adb commands.
@@ -244,17 +135,15 @@ module Appium
244
135
  # @driver.get_performance_data_types #=> ["cpuinfo", "batteryinfo", "networkinfo", "memoryinfo"]
245
136
  #
246
137
 
247
- # @deprecated Use 'mobile: getPerformanceData' extension instead.
248
- # @!method get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
138
+ # @!method get_performance_data(package_name:, data_type:)
249
139
  # Get the resource usage information of the application.
250
140
  # https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
251
141
  # @param [String] package_name: Package name
252
142
  # @param [String] data_type: Data type get with +get_performance_data_types+
253
- # @param [String] data_read_timeout: Command timeout. Default is 2.
254
143
  #
255
144
  # @example
256
145
  #
257
- # @driver.get_performance_data package_name: package_name, data_type: data_type, data_read_timeout: 2
146
+ # @driver.get_performance_data package_name: package_name, data_type: data_type
258
147
  #
259
148
 
260
149
  # @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil, video_size: nil, time_limit: '180', bit_rate: '4000000', bug_report: nil)
@@ -324,7 +213,6 @@ module Appium
324
213
  # @driver.set_clipboard(content: 'happy testing') #=> {"protocol"=>"W3C"}
325
214
  #
326
215
 
327
- # @deprecated Use 'mobile: fingerprint' extension instead.
328
216
  # @!method finger_print(finger_id)
329
217
  # Authenticate users by using their finger print scans on supported emulators.
330
218
  #
@@ -364,110 +252,51 @@ module Appium
364
252
 
365
253
  ::Appium::Core::Device.add_endpoint_method(:open_notifications) do
366
254
  def open_notifications
367
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: openNotifications' extension instead"
368
-
369
- execute :open_notifications
255
+ execute_script 'mobile:openNotifications', {}
370
256
  end
371
257
  end
372
258
 
373
259
  ::Appium::Core::Device.add_endpoint_method(:current_activity) do
374
260
  def current_activity
375
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentActivity' extension instead"
376
-
377
- execute :current_activity
261
+ execute_script 'mobile:getCurrentActivity', {}
378
262
  end
379
263
  end
380
264
 
381
265
  ::Appium::Core::Device.add_endpoint_method(:current_package) do
382
266
  def current_package
383
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getCurrentPackage' extension instead"
384
-
385
- execute :current_package
267
+ execute_script 'mobile:getCurrentPackage', {}
386
268
  end
387
269
  end
388
270
 
389
271
  ::Appium::Core::Device.add_endpoint_method(:get_system_bars) do
390
272
  def get_system_bars
391
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
392
-
393
- execute :get_system_bars
273
+ execute_script 'mobile:getSystemBars', {}
394
274
  end
395
275
  end
396
276
  # as alias to get_system_bars
397
277
  ::Appium::Core::Device.add_endpoint_method(:system_bars) do
398
278
  def system_bars
399
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: getSystemBars' extension instead"
400
-
401
- execute :get_system_bars
279
+ execute_script 'mobile:getSystemBars', {}
402
280
  end
403
281
  end
404
282
 
405
283
  ::Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
406
284
  def toggle_location_services
407
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: toggleGps' extension instead"
408
-
409
- execute :toggle_location_services
410
- end
411
- end
412
-
413
- ::Appium::Core::Device.add_endpoint_method(:start_activity) do
414
- def start_activity(opts)
415
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: startActivity' extension instead"
416
-
417
- raise ::Appium::Core::Error::ArgumentError, 'opts must be a hash' unless opts.is_a? Hash
418
-
419
- option = {}
420
-
421
- app_package = opts[:app_package]
422
- raise ::Appium::Core::Error::ArgumentError, 'app_package is required' unless app_package
423
-
424
- app_activity = opts[:app_activity]
425
- raise ::Appium::Core::Error::ArgumentError, 'app_activity is required' unless app_activity
426
-
427
- option[:appPackage] = app_package
428
- option[:appActivity] = app_activity
429
-
430
- app_wait_package = opts.fetch(:app_wait_package, nil)
431
- app_wait_activity = opts.fetch(:app_wait_activity, nil)
432
- option[:appWaitPackage] = app_wait_package if app_wait_package
433
- option[:appWaitActivity] = app_wait_activity if app_wait_activity
434
-
435
- intent_action = opts.fetch(:intent_action, nil)
436
- intent_category = opts.fetch(:intent_category, nil)
437
- intent_flags = opts.fetch(:intent_flags, nil)
438
- optional_intent_arguments = opts.fetch(:optional_intent_arguments, nil)
439
- dont_stop_app_on_reset = opts.fetch(:dont_stop_app_on_reset, nil)
440
-
441
- option[:intentAction] = intent_action if intent_action
442
- option[:intentCategory] = intent_category if intent_category
443
- option[:intentFlags] = intent_flags if intent_flags
444
- option[:optionalIntentArguments] = optional_intent_arguments if optional_intent_arguments
445
- option[:dontStopAppOnReset] = dont_stop_app_on_reset if dont_stop_app_on_reset
446
-
447
- execute :start_activity, {}, option
285
+ execute_script 'mobile:toggleGps', {}
448
286
  end
449
287
  end
450
288
 
451
289
  # Android, Override included method in bridge
452
290
  ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
453
- def hide_keyboard(close_key = nil, strategy = nil)
454
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: hideKeyboard' extension instead"
455
-
456
- option = {}
457
-
458
- option[:key] = close_key if close_key
459
- option[:strategy] = strategy if strategy
460
-
461
- execute :hide_keyboard, {}, option
291
+ def hide_keyboard(_close_key = nil)
292
+ execute_script 'mobile:hideKeyboard', {}
462
293
  end
463
294
  end
464
295
 
465
296
  # Android, Override included method in bridge
466
297
  ::Appium::Core::Device.add_endpoint_method(:background_app) do
467
298
  def background_app(duration = 0)
468
- ::Appium::Logger.warn "[DEPRECATION] Please use 'mobile: backgroundApp' extension instead"
469
-
470
- execute :background_app, {}, seconds: duration
299
+ execute_script 'mobile:backgroundApp', { seconds: duration }
471
300
  end
472
301
  end
473
302
 
@@ -482,7 +311,6 @@ module Appium
482
311
 
483
312
  Screen.add_methods
484
313
  Performance.add_methods
485
- Network.add_methods
486
314
  Clipboard.add_methods
487
315
  Emulator.add_methods
488
316
  Authentication.add_methods
@@ -68,7 +68,7 @@ module Appium
68
68
  #
69
69
  # new_driver = ::Appium::Core::Driver.attach_to(
70
70
  # driver.session_id,
71
- # url: 'http://127.0.0.1:4723/wd/hub', automation_name: 'UiAutomator2', platform_name: 'Android'
71
+ # url: 'http://127.0.0.1:4723', automation_name: 'UiAutomator2', platform_name: 'Android'
72
72
  # )
73
73
  #
74
74
  def attach_to(session_id, platform_name, automation_name)
@@ -245,20 +245,6 @@ module Appium
245
245
  ::Appium::Core::Element.new self, element_id_from(id)
246
246
  end
247
247
 
248
- # For Appium
249
- # override
250
- # called in 'extend DriverExtensions::HasNetworkConnection'
251
- def network_connection
252
- execute :get_network_connection
253
- end
254
-
255
- # For Appium
256
- # override
257
- # called in 'extend DriverExtensions::HasNetworkConnection'
258
- def network_connection=(type)
259
- execute :set_network_connection, {}, { parameters: { type: type } }
260
- end
261
-
262
248
  # For Appium
263
249
  # No implementation for W3C webdriver module
264
250
  # called in 'extend DriverExtensions::HasLocation'