12 August 2017

Android ADB Screenshot Automation



In this blog post  I will describe how to take screenshot from emulator or device in android. This commands only works for single adb device.I have write some shell script to take screenshots. Anyway android studio have feature to take screenshot .But if your not going with studio this might help.Hope this will help resolve your problems.

#!/bin/bash
adb shell am start -n juwelary.innova.dev.juwelarytemplate/juwelary.innova.dev.juwelarytemplate.MainActivity
sleep 5
name=screenshot.png
echo "Start to take screenshot"
adb shell screencap -p /sdcard/$name
adb pull /sdcard/$name
adb shell rm /sdcard/$name
curr_dir=pwd
echo "save to `pwd`/$name"

No comments:

Post a Comment