Camera Related ADB Commands


There are few media related adb commands which are as below

1. adb command to capture video

This command is use to launch the camera app in video recording mode.
adb shell am start -a android.media.action.VIDEO_CAPTURE
The below screen will be launched.


After this you can use either coordinate to click on recording button or you can use the uiautomator python ui element identification method. (Which have been covered in later sections)

2. adb command to capture IMAGE

This command is use to launch the camera app in image capturing mode.
adb shell am start -a android.media.action.IMAGE_CAPTURE
Below is the screen which will be launched after firing this adb command


After this you can use either coordinate to click on recording button or you can use the uiautomator python ui element identification method. (Which have been covered in later sections)

3. adb screencap command
There are many ways to  take screenshot in android smartphone device. Holding power and Volume button simultaneously allows you to take screenshot.This command is use to take screenshot of a frame and can be saved at sdcard folder with name screenshot.png. By using pull command you can also pull the screenshot.png from device to desktop /lapptop.
adb shell screencap -p /sdcard/screenshot.png.
4. adb screenrecord command

This command is use to record the screen activity and store them on sdcard folder. Here too you can pull the test.mp4 using pull command from device to desktop/laptop. 
adb shell screenrecord /sdcard/test.mp4

No comments:

Post a Comment

Feature Posts

Python Appium - Step by step procedure for capturing screenshot

 Why To capture screenshot? It is as important as your logs. If there is any failure for any test scenario, we can provide screenshot for th...