-
-
Notifications
You must be signed in to change notification settings - Fork 761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Screenshots not working: Illegal base64 character a #1783
Comments
This is happening because of SeleniumHQ/selenium#11168 |
Thanks, I tried downgrading up to 4.0.0, but still same issue. I'd rather avoid to downgrade to Selenium 3.x alltogether, any other option? |
The issue is relevant for Selenium Java client |
I'm sorry, but as I said, even with Selenium 4.0.0 I'm facing the same problem |
Right now I ran a dependency:tree on the pom, and it seems Appium java client still downloads selenium remote driver 4.5.3 as transitive dependency. [INFO] Downloaded from central: https://repo.maven.apache.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar (575 kB at 1.4 MB/s) |
@algernon28 just add explicit Selenium dependencies |
@valfirst I added the two libraries to dependency management to resolve. Thanks |
Thanks @algernon28 , I was facing the same issue. This thread saved me :) |
I am also having same issue. Can you help how you resolved? |
Sure, Summarizing: Make sure you have selenium not above 4.5.0 <dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>4.5.0</version>
</dependency>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>4.5.0</version>
</dependency>
</dependencies>
</dependencyManagement> That way you are making 4.5.0 explicit and your libraries will stick to those. |
Thank you . It is working with above work around and it saved my day. |
Hi, I am facing java.lang.IllegalArgumentException: Illegal base64 character. Environment details : Appium version: 1.15.1,1.22.0 Dependencies am using : io.appium java-client 8.1.1 org.testng testng 6.14.3 ru.sbtqa.tag page-factory 1.3.0 org.seleniumhq.selenium selenium-support 4.5.0 com.aventstack extentreports 4.1.3 org.seleniumhq.selenium selenium-java 3.14.0 com.relevantcodes extentreports 2.41.2I am facing below Exception while trying to capture screenshot on Test Failure: [RemoteTestNG] detected TestNG version 7.4.0 |
@kajalpal2021, Did you tried above work around suggested by @algernon28. It worked for me after excluding libraries in Appium java client dependency. Refer above two posts. |
@algernon28 I had the same problem |
No this is an Appium java client issue, as stated in the discussion. |
I have used the two methods.the error is gone but extent report is not generated.any suggestions? |
The error (and this thread) was only referred to the screenshot problem,
I'm not even using Extent.
If you are experiencing some problem other than this I suggest you open
another issue, with the link to your Appium log.
Just saying "doesn't work" isn't going to help
…On Tue, 8 Nov 2022, 15:20 ashokreddy-k, ***@***.***> wrote:
I have used the two methods.the error is gone but extent report is not
generated.
—
Reply to this email directly, view it on GitHub
<#1783 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXFO4U5GJSLBSDOM5VTKW3WHJOURANCNFSM6AAAAAARPA4X44>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The issue has been addressed since v 8.2.1 |
need appium fix for screenshot appium/java-client#1783
Using Selenium 4.7.0 and io.appium:java-client 8.3.0, this issue is still present. Just so you can see that there are no conflicts at all with the dependencies included with The error message when running this code ... byte[] bytes = appiumDriver.findElement(AppiumBy.id("myId").getScreenshotAs(OutputType.BYTES); ... looks like this:
Edit String base64 = appiumDriver.findElement(AppiumBy.id("myId")..getScreenshotAs(OutputType.BASE64);
base64 = base64.replaceAll("[\n\r]", "");
byte[] bytes = Base64.getDecoder().decode(base64); |
I meet a similar issue, then I downgrade java-client version to 8.1.1 and it works |
@mykola-mokhnach latest comments suggests the issue still persists in 8.3.0, please advise. |
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://.page.link/tggE
Environment
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
The text was updated successfully, but these errors were encountered: