In this Post we will learn about must know ADB commands for appium and how
we can use adb commands from command line prompt. Because these are
basic commands automation engineer should know. We will learn below adb
commands:
command: adb start-server
- Adb start-server
- Adb kill-server
- Adb version
- Adb devices
- Adb install
- Adb logcat
ADB : ADB stands for Android Debug Bridge. It is a command
line tool that lets us communicate with an Android device or an
Emulator. It is a client-server program that includes
three components:
-
A client, which runs on our machine. We can invoke a client by issuing an
adb command.
- A daemon, which runs as a background process on each emulator or device instance. It by default runs on port number 5037
- A server, which runs as a background process on our machine. It manages communication between the client and the adb daemon running on an emulator or device.
1. Adb start-server: This command checks whether the adb server is running and starts it,
if not running. sometimes adb server not started or killed. that time we should use
this command.
2. adb kill-server : This command terminates the adb
server. in some cases like you are not able to find your device is
not listing or issues with adb server. we should use this command to
kill the existing instance and again use adb start-server command to
start freshly.
command:
adb version
4. adb devices: This command prints status information of
all the attached devices. when you to give the udid or device name in
your appium script, you should execute this command to know the device
name and udid.
Command:
adb devices
This displays the information in the format:
Serial Number State
6a2ed0b
device
Serial Number: A string created by adb to uniquely identify an
emulator/device
State: The connection state of the instance. It can be offline,
device, no device
- Offline : The device is not connected or not responding
- device : The device is connected to adb server
- no device : There is no device connected to adb server
5. Adb install: This command will install the apk
file to attached device / emulator. whenver you want to install the
apk file from your computer, connect your device and you can use
this command to install apk by giving the path.
Command:
adb install <local_path_to_apk>
Note: Emulator should be up & running before firing adb
install command. In the above screen shot emulator-5554 is displayed
with device status, it means it is up & running.
Note: the path of my APK file is D:\ ApiDemos-debug.apk
6. adb logcat: This command will print the logs data to
the screen for the purposes of bug reporting. We can also store these
logs into local file using below command:
Command:
adb logcat > <local_path_to_text_file>
No comments:
Post a Comment
If any suggestions or issue, please provide