Module: Appium::Core::Android::Device
- Extended by:
- Forwardable
- Defined in:
- lib/appium_lib_core/android/device.rb,
lib/appium_lib_core/android/device/screen.rb,
lib/appium_lib_core/android/device/emulator.rb,
lib/appium_lib_core/android/device/clipboard.rb,
lib/appium_lib_core/android/device/performance.rb,
lib/appium_lib_core/android/device/auth_finger_print.rb
Defined Under Namespace
Modules: Authentication, Clipboard, Emulator, Performance, Screen
Class Method Summary collapse
Instance Method Summary collapse
-
#current_activity ⇒ String
Get current activity name.
-
#current_package ⇒ String
Get current package name.
-
#execute_cdp(cmd, **params) ⇒ Object
Execute Chrome Devtools protocol commands chromedevtools.github.io/devtools-protocol.
-
#finger_print(finger_id) ⇒ Object
Authenticate users by using their finger print scans on supported emulators.
-
#get_clipboard(content_type: :plaintext) ⇒ Object
Set the content of device’s clipboard.
-
#get_display_density ⇒ Integer
Get connected device’s density.
-
#get_performance_data(package_name: , data_type: ) ⇒ Object
Get the resource usage information of the application.
-
#get_performance_data_types ⇒ Object
Get the information type of the system state which is supported to read such as cpu, memory, network, battery via adb commands.
-
#get_system_bars ⇒ String
Get system bar’s information.
-
#hide_keyboard(close_key = nil) ⇒ Object
Hide the onscreen keyboard.
-
#location ⇒ ::Appium::Location
Get the location of the device.
-
#location= ⇒ ::Appium::Location
Get the location of the device.
-
#open_notifications ⇒ Object
Open Android notifications.
-
#set_clipboard(content: , content_type: :plaintext, label: nil) ⇒ Object
Set the content of device’s clipboard.
-
#set_location(latitude, longitude, altitude, speed: nil, satellites: nil) ⇒ Object
Set the location of the device.
-
#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) ⇒ String
Base64 encoded content of the recorded media file or an empty string if the file has been successfully uploaded to a remote location (depends on the actual options).
-
#toggle_location_services ⇒ Object
Switch the state of the location service.
Class Method Details
.extended(_mod) ⇒ Object
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/appium_lib_core/android/device.rb', line 250 def extended(_mod) ::Appium::Core::Device.extend_webdriver_with_forwardable ::Appium::Core::Device.add_endpoint_method(:open_notifications) do def open_notifications execute_script 'mobile:openNotifications', {} end end ::Appium::Core::Device.add_endpoint_method(:current_activity) do def current_activity execute_script 'mobile:getCurrentActivity', {} end end ::Appium::Core::Device.add_endpoint_method(:current_package) do def current_package execute_script 'mobile:getCurrentPackage', {} end end ::Appium::Core::Device.add_endpoint_method(:get_system_bars) do def execute_script 'mobile:getSystemBars', {} end end # as alias to get_system_bars ::Appium::Core::Device.add_endpoint_method(:system_bars) do def execute_script 'mobile:getSystemBars', {} end end ::Appium::Core::Device.add_endpoint_method(:toggle_location_services) do def toggle_location_services execute_script 'mobile:toggleGps', {} end end # Android, Override included method in bridge ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do def hide_keyboard(_close_key = nil) execute_script 'mobile:hideKeyboard', {} end end # Android, Override included method in bridge ::Appium::Core::Device.add_endpoint_method(:background_app) do def background_app(duration = 0) execute_script 'mobile:backgroundApp', { seconds: duration } end end ::Appium::Core::Device.add_endpoint_method(:execute_cdp) do # SeleniumWebdriver could already define this method return if method_defined? :execute_cdp def execute_cdp(cmd, **params) execute :chrome_send_command, {}, { cmd: cmd, params: params } end end Screen.add_methods Performance.add_methods Clipboard.add_methods Emulator.add_methods Authentication.add_methods end |
Instance Method Details
#current_activity ⇒ String
Get current activity name
|
# File 'lib/appium_lib_core/android/device.rb', line 37
|
#current_package ⇒ String
Get current package name
|
# File 'lib/appium_lib_core/android/device.rb', line 46
|
#execute_cdp(cmd, **params) ⇒ Object
Execute Chrome Devtools protocol commands chromedevtools.github.io/devtools-protocol
|
# File 'lib/appium_lib_core/android/device.rb', line 226
|
#finger_print(finger_id) ⇒ Object
Authenticate users by using their finger print scans on supported emulators.
|
# File 'lib/appium_lib_core/android/device.rb', line 216
|
#get_clipboard(content_type: :plaintext) ⇒ Object
Set the content of device’s clipboard.
|
# File 'lib/appium_lib_core/android/device.rb', line 195
|
#get_display_density ⇒ Integer
Get connected device’s density.
|
# File 'lib/appium_lib_core/android/device.rb', line 65
|
#get_performance_data(package_name: , data_type: ) ⇒ Object
Get the resource usage information of the application. github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
|
# File 'lib/appium_lib_core/android/device.rb', line 138
|
#get_performance_data_types ⇒ Object
Get the information type of the system state which is supported to read such as cpu, memory, network, battery via adb commands. github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L300
|
# File 'lib/appium_lib_core/android/device.rb', line 128
|
#get_system_bars ⇒ String
Get system bar’s information
|
# File 'lib/appium_lib_core/android/device.rb', line 55
|
#hide_keyboard(close_key = nil) ⇒ Object
Hide the onscreen keyboard
|
# File 'lib/appium_lib_core/android/device.rb', line 117
|
#location ⇒ ::Appium::Location
Get the location of the device.
Set the [::Appium::Location] of the device.
|
# File 'lib/appium_lib_core/android/device.rb', line 74
|
#location= ⇒ ::Appium::Location
Get the location of the device.
Set the [::Appium::Location] of the device.
|
# File 'lib/appium_lib_core/android/device.rb', line 74
|
#open_notifications ⇒ Object
Open Android notifications
|
# File 'lib/appium_lib_core/android/device.rb', line 29
|
#set_clipboard(content: , content_type: :plaintext, label: nil) ⇒ Object
Set the content of device’s clipboard.
|
# File 'lib/appium_lib_core/android/device.rb', line 205
|
#set_location(latitude, longitude, altitude, speed: nil, satellites: nil) ⇒ Object
Set the location of the device.
|
# File 'lib/appium_lib_core/android/device.rb', line 91
|
#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) ⇒ String
Returns Base64 encoded content of the recorded media file or an empty string if the file has been successfully uploaded to a remote location (depends on the actual options).
|
# File 'lib/appium_lib_core/android/device.rb', line 149
|
#toggle_location_services ⇒ Object
Switch the state of the location service
|
# File 'lib/appium_lib_core/android/device.rb', line 107
|