Sha256: 3010e43e81c7f2039c889eb06da896e795a171fe00634e1e6c485019bfeaf060

Contents?: true

Size: 1.38 KB

Versions: 10

Compression:

Stored size: 1.38 KB

Contents

# Mobile Command

Appium has `mobile:` command.
We can invoke them via `execute_script` command with `mobile:` arguments.

- root:
    - https://github.com/appium/appium/blob/master/commands-yml/commands/mobile-command.yml
- Android:
    - https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android
- iOS:
    - https://github.com/appium/appium/tree/master/docs/en/writing-running-appium/ios


```ruby
# Android shell : https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/android-shell.md
args = { command: 'echo', args: 'list' }
@driver.execute_script 'mobile: shell', args # Run `adb shell echo 'list'`

# iOS performance : https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios/ios-xctest-performance.md
args = { timeout: 60 * 1000, profileName: 'Activity Monitor' }
@driver.execute_script 'mobile: startPerfRecord', args

@driver.execute_script 'mobile: stopPerfRecord', { profileName: 'Activity Monitor' }
```

Mobile commands return their error messages. As a selenium client, it usually handles as unknown error.
To handle it, we would recommend you to handle the error based on the error message.

```ruby
error = assert_raises ::Selenium::WebDriver::Error::UnknownError do
  @driver.execute_script 'mobile: scrollToPage', { element: el.id, scrollToPage: -100 }
end
assert error.message.include? 'be a non-negative integer'
```

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
appium_lib_core-5.1.0 docs/mobile_command.md
appium_lib_core-5.0.3 docs/mobile_command.md
appium_lib_core-5.0.2 docs/mobile_command.md
appium_lib_core-5.0.1 docs/mobile_command.md
appium_lib_core-5.0.0 docs/mobile_command.md
appium_lib_core-5.0.0.rc8 docs/mobile_command.md
appium_lib_core-5.0.0.rc7 docs/mobile_command.md
appium_lib_core-5.0.0.rc6 docs/mobile_command.md
appium_lib_core-5.0.0.rc5 docs/mobile_command.md
appium_lib_core-5.0.0.rc4 docs/mobile_command.md