## The problem Whenever I try to take screenshots with Android driver, I get this error in my cucumber hook. java.lang.IllegalArgumentException: Illegal base64 character a at java.base/java.util.Base64$Decoder.decode0(Base64.java:847) at java.base/java.util.Base64$Decoder.decode(Base64.java:566) at java.base/java.util.Base64$Decoder.decode(Base64.java:589) at org.openqa.selenium.OutputType$2.convertFromBase64Png(OutputType.java:58) at org.openqa.selenium.OutputType$2.convertFromBase64Png(OutputType.java:55) at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:335) at com.watermelon.mobile.hooks.MobileHooks.takeScreenshot(MobileHooks.java:85) at com.watermelon.mobile.hooks.MobileHooks.screenshot(MobileHooks.java:56) Might be useful to say that I open the app with a deepLink https://<appName>.page.link/tggE ## Environment * Appium version (or git revision) that exhibits the issue: both 1.22.3 and app 1.22.3-4 * Last Appium version that did not exhibit the issue (if applicable): * Desktop OS/version used to run Appium: Windows 10 * Node.js version (unless using Appium.app|exe):16.8.0 (but same problem with exe) * Npm or Yarn package manager: * Mobile platform/version under test: Appium client 8.2.0, selenium-support 4.5.0, testng 7.6.1, cucumber-java 7.8.1, cluecumber-report-plugin 2.9.3 * Real device or emulator/simulator: emulator Android 12.0 x86_64 "Pixel 4", graphics: automatic, cold-boot. Chrome v. 91 * Appium CLI or Appium.app|exe: 1.22.3-4 ## Details If necessary, describe the problem you have been experiencing in more detail. ## Link to Appium logs https://gist.github.com/algernon28/6e067391b94026e3051abc0779774a3c ## Code To Reproduce Issue [ Good To Have ] Capabilities: { "platformName": "Android", "appium:platformVersion": "12.0", "appium:automationName": "UiAutomator2", "appium:deviceName": "emulator-5554", "appium:deviceOrientation": "portrait", "appium:avd": "A12", "appium:newCommandTimeout": "120", "appium:browserName": "Chrome" } the app is installed thru a @Before hook @Before(order = 1) public void startUp(){ InteractsWithApps ad = ((InteractsWithApps) driver); String appFile = System.getProperty(MobileConstants.OPTION_APPFILE); String appID = System.getProperty(MobileConstants.OPTION_APPID); if(driver.getCapabilities().getCapability("app") != null) return; if (!ad.isAppInstalled(appID)){ ad.installApp(Paths.get(appFile).toAbsolutePath().toString()); } else{ ad.removeApp(appID); ad.installApp(Paths.get(appFile).toAbsolutePath().toString()); } } I access the app with this code: driver.get(deeplink url); -- Deep link gets opened via Chrome ((AndroidDriver) driver).context("NATIVE_APP"); -- follows test code -- the screenshot is taken after each step screenshot = driver.getScreenshotAs(OutputType.BYTES); When debugging, it seems to fail where the driver tries to convert the png to base64