I want to save the screenshot to /sdcard/Robotium-Screenshots/testLogin/en/
.
The following code work perfectly fine. It creates a testLogin
folder in Robotium-Screenshots
and save the screenshot:
String path = "/sdcard/Robotium-Screenshots/testLogin/";
solo.getConfig().screenshotSavePath = "/sdcard/Robotium-Screenshots/";
solo.takeScreenshot("abc");
But when I change the path to:
String path = "/sdcard/Robotium-Screenshots/testLogin/en/";
I cannot find testLogin
and en
folders and screenshots.
Had the same problem, it doesn't work because the directory does not exist yet. With the following code, I check if the directory exists and create the directory if it does not.
File directory = new File(path);
if (!directory.exists()) {
directory.mkdirs();
}
After making sure the directory exists, you can take the screenshot. I hope this helped!!