Unsupported MIME type


I try to take a screenshot when my test fails. I can take a screenshot on the ios device but not on the android device.
It fails with the error of:
[MJSONWP] Encountered internal error running command: Error: Unsupported MIME type:
at Jimp.throwError (/usr/local/lib/node_modules/appium/node_modules/jimp/index.js:82:43)
at Jimp.parseBitmap (/usr/local/lib/node_modules/appium/node_modules/jimp/index.js:307:31)
at /usr/local/lib/node_modules/appium/node_modules/jimp/index.js:200:29
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

it used to work on appium 1.4.16. now i am on appium 1.6.0
this is my code:
public static String captureScreenshot(AppiumDriver driver, String screenshotName){
try {
TakesScreenshot ts = driver;
File source = ts.getScreenshotAs(OutputType.FILE);
String dest = “/Users/automation/Desktop/Reports/” +screenshotName+".png";
File destination = new File(dest);
System.out.println(“Screenshot was taken”);
return dest;
} catch (IOException e) {
Log.report(“Exception while taking the screenshot”);
return e.getMessage();

any idea how to solve this?


1 Like

I got the same error. But not sure about the reason.

I also have the same error. Tried multiple solutions but the error persists.