How to take a screenshot in robotium?
In this article we are going to see how to take a screenshot in an Android device while performing Unit Testing using robotium framework.
After Initiating solo, we need to use the object of solo.
-To take screenshot with default naming
solo.takeScreenshot();
-To take screenshot with our given name
solo.takeScreenshot("NameOfTheFile");
-To take screenshot with our given name along with given quality
solo.takeScreenshot("NameOfTheFile",5);
Note :
-Default naming makes the name with current date and time.
-The given quality is measured by compression rate(in integer) 0-100 of the screen shot. 0=lowest size, 100= max quality.
-By default, it saves the screenshot in "/sdcard/Robotium-Screenshots/", So if you are using emulator, do not forget keep an SD card.
-As, it will store, it will need write permission in AndroidManifest.xml
(android.permission.WRITE_EXTERNAL_STORAGE)
for latest revision, if we forget to permit this,
Thanks..:)
After Initiating solo, we need to use the object of solo.
-To take screenshot with default naming
solo.takeScreenshot();
-To take screenshot with our given name
solo.takeScreenshot("NameOfTheFile");
-To take screenshot with our given name along with given quality
solo.takeScreenshot("NameOfTheFile",5);
Note :
-Default naming makes the name with current date and time.
-The given quality is measured by compression rate(in integer) 0-100 of the screen shot. 0=lowest size, 100= max quality.
-By default, it saves the screenshot in "/sdcard/Robotium-Screenshots/", So if you are using emulator, do not forget keep an SD card.
-As, it will store, it will need write permission in AndroidManifest.xml
(android.permission.WRITE_EXTERNAL_STORAGE)
for latest revision, if we forget to permit this,
Thanks..:)