question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getScreenshotAs as BASE64 produces string with new line characters

See original GitHub issue

The problem

String generated by getScreenshotAs method is not valid base64 string

((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64)

Environment

  • Appium version (or git revision) that exhibits the issue: 1.18.1
  • Last Appium version that did not exhibit the issue (if applicable): don’t know (
  • Desktop OS/version used to run Appium: iOS Catalina 10.15.6
  • Node.js version (unless using Appium.app|exe): 12.18.1
  • Npm or Yarn package manager: npm
  • Mobile platform/version under test: iOS
  • Real device or emulator/simulator: emulator
  • Appium CLI or Appium.app|exe: Appium CLI

Details

1

Code To Reproduce Issue [ Good To Have ]

https://github.com/pashidlos/appium-issue-14684/blob/master/src/test/java/TestExample.java

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
valfirstcommented, Oct 24, 2022

Selenium Java client follows RFC4648 starting from 4.5.1: https://github.com/SeleniumHQ/selenium/pull/11107 (I’m not sure about other clients). Is it something to be handled on Appium server side? Or Appium Java client side?

0reactions
KazuCocoacommented, Oct 25, 2022

Could you create an issue in the Java client? We maybe update server side to not have \n but potentially old Android/chrome (for example) needs the old one. WinAppDriver, for example, as well. So, at least Appium client may need to keep the old one still.

[append] https://github.com/appium/WebDriverAgent/search?q=base64EncodedStringWithOptions it seems like… the method in appium/WDA was fastest in 10 times average in each options on my local. (0.01 or less tho). Hm…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does the base64 of a string contain "\n"? - Super User
Wrap encoded lines after COLS character (default 76 ). ... to co-operate, I am using tr to indiscriminately strip every newline on stdout....
Read more >
getScreenshotAs as BASE64 produces string with new line characters
The problem. String generated by getScreenshotAs method is not valid base64 string ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64) ...
Read more >
How to write a generic base64 screenshot method using ...
2 Answers 2 ; static String getScreenshot ; String screenshotBase64 ; = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64); return ...
Read more >
Base64 Encoded String Contains a line break '\n' - Search
It appears that there is a limitation of 76 char for Base64 encoded sting and a line break is added after 76 characters....
Read more >
5.0.5 - Attaching screenshot as Base64 String to Report - Part VII
Take a screenshot as png , jpg file - convert to base64 string and ... ... Extent Report Latest - 5.0.5 - Attaching...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found