Android Screenshot by POWER&VolDwon buttons

Mobile Testing, Android App Testing.
Speedboat
Certified Professional
Certified Professional
Posts: 31
Joined: Wed Mar 25, 2015 4:44 pm
Location: Switzerland

Android Screenshot by POWER&VolDwon buttons

Post by Speedboat » Tue Nov 29, 2016 2:40 pm

Hi

The integrated screenshot function of Ranorex on Android devices can not be used for google map views
(the recorded screen content is black).

Is there a way to trigger "POWER & VolumeDown" or any other method to use the built in Android screenshot function?

Thanks a lot!

Android 6.0.1 / Google Nexus 4
Ranorex 6.1.1

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: Android Screenshot by POWER&VolDwon buttons

Post by asdf » Tue Nov 29, 2016 5:28 pm

Hi Speedboat,

Have you already tried it through ADB?
Just copy the code below to a batch file and execute it.
Please be aware that this will only work with an USB connection.

Code: Select all

@echo off
cd C:\Program Files (x86)\Ranorex 6.1\Bin\RxEnv\Android\tools
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png C:\Temp\screen1.png
cd C:\Temp\
screen1.png
A screenshot will be fetched and will get pulled to your machine and saved in the C:\Temp\.
Afterwards, it just open the image.

You might have to adapt the path to the adb.exe, if you are not using Ranorex 6.1.

Hope this helps.

Best regards,
asdf

Speedboat
Certified Professional
Certified Professional
Posts: 31
Joined: Wed Mar 25, 2015 4:44 pm
Location: Switzerland

Re: Android Screenshot by POWER&VolDown buttons

Post by Speedboat » Wed Nov 30, 2016 9:54 am

Hi asdf

Thanks, works perfect 8)
(Didn't think about that)

With the command:
adb connect <device tcp>:5555
it works even fine the visual studio emulator and will also work
over Wifi hopefully.

Thanks,
Speedboat