I tried to take a screenshot in the internal storage during automation testing,but when run the test,it didn't show any error,but when I check the file,the screenshot didn't take successfully,I am so confused right now,please help me~
Here is part of my code:
I have my permission in my AndroidManifest.xml already
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS "/>
screenshot
UiDevice mDevice =UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
mDevice.pressHome();
mDevice.takeScreenshot(new File("/sdcard/Pictures/test.png"));
sleep(3000);
I am sure the direction is not wrong cause I tried the same code before,it worked normally,but after few days I tired it again and it failed without showing any error.