To take a screenshot from an Android TV using ADB:
1. Capture the screenshot on the TV
adb shell screencap -p /sdcard/screenshot.png
2. Copy it to your computer
adb pull /sdcard/screenshot.png
3. (Optional) Delete the file from the TV
adb shell rm /sdcard/screenshot.png
One-liner
adb shell screencap -p /sdcard/screenshot.png && adb pull /sdcard/screenshot.png
Save directly to your computer
On most systems:
adb exec-out screencap -p > screenshot.png
If the PNG appears corrupted on Windows, try:
adb shell screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png
Verify ADB connection
adb devices
Get the screen resolution
adb shell wm size
This can be useful to confirm the screenshot dimensions.
If you're automating testing, you can combine screenshots with key events such as:
adb shell input keyevent KEYCODE_HOME
adb shell screencap -p /sdcard/home.png
adb pull /sdcard/home.png

No comments:
Post a Comment