Home:ALL Converter>TakeScreenshot with AWS Device Farm and UIAutomator 2

TakeScreenshot with AWS Device Farm and UIAutomator 2

Ask Time:2017-05-20T00:32:44         Author:driedel

Json Formatter

I've got a problem with my automated UI tests using AWS device farm. I tried to create a new UIAutomator 2 test. This works fine on my device and my development machine.

No I created a new test run in AWS device farm to run this test on all the other devices creating screenshot output. The problem here seems to be in taking the screenshots.

With Automator 2 I take my screenshots using automator frameworks UIDevie.takeScreenshot method. This method takes a File as parameter.

As described in AWS documentation I tried to store the file using the /sdcard/ folder as well as Environment.getExternalStorageDirectory(). None of those directories seem to work.

With Environment.getExternalStorageDirectory() I get the following LOG:

Error UiAutomatorBridge java.io.FileNotFoundException: /storage/emulated/0/test-screenshots/coupondetail-screen-2.png: open failed: EACCES (Permission denied)

Author:driedel,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/44074912/takescreenshot-with-aws-device-farm-and-uiautomator-2
yy