Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

 
SEO Metadata
titleSeeTest Automation- Run

Run adb commands or other device shell commands.



String Run(String command)

Supported_os
SupportAndroidtrue

Description

Run adb commands or other device shell commands.

Parameters

  • Command: The command to run

Usage

The 'Run' command provides you the ability to run many commands for advanced capabilities.

The following example will demonstrate how to get the version of the device.

We will use the command getprop ro.build.version.release.

Step 1: Devices one is connected through cloud (Nexus 4) and other is connected locally via USB (Nexus 5).

Step 2: Getting the version number from cloud device (Nexus 4).

Step 3: Getting the version from the physically connected devices via USB (Nexus 5).

Code Examples

Code Block
languagejava
titleTo open Settings screen of the device:
collapsetrue
client.run("adb shell am start -a android.settings._SETTINGS")
Code Block
languagejava
titleTo open Wifi screen on the device:
collapsetrue
client.run("adb shell am start -a android.settings.WIFI_SETTINGS")
Code Block
languagejava
titleFor pressing Volume key up:
collapsetrue
client.run("adb shell input keyevent "KEYCODE_VOLUME_UP"')
Code Block
languagejava
titleFor pressing Volume key down:
collapsetrue
client.run("adb shell input keyevent "KEYCODE_VOLUME_DOWN"')
Code Block
languagejava
titlePush file
collapsetrue
// please note that the path in your android device should include the file name, and should not end with a directory 
client.run("adb push C:\\Users\\khaled.abbas\\Pictures\\myPicture.png /sdcard/Pictures/myPicture.png");
Code Block
languagejava
titleCall a number:
collapsetrue
client.run("adb shell am start -a android.intent.action.CALL -d tel:+6512345678");