Is it Possible to take screenshot on devices

Is it Possible to take screenshot on devices in case of test failures??

Yes …it’s possible…you can use below code for taking the screen shot

System.out.println(“take screen shot”);

		File scrFile = driver.getScreenshotAs(OutputType.FILE);
		String fileName = UUID.randomUUID().toString();
		File targetFile = new File("E:/Appium/" + fileName+".jpg");
		FileUtils.copyFile(scrFile,targetFile);
		
		
		System.out.println("done");