appium / appium/java-client

On Android: getScreenshotAs returns com.google.common.collect.Maps$TransformedEntriesMap instead of byte array

Open
#1,596 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description

On Android, when I'm attempting to call getScreenshotAs(OutputType.BYTES), under certain situations, it fires:

java.lang.RuntimeException: Unexpected result for screenshot command: com.google.common.collect.Maps$TransformedEntriesMap instance
        at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:357)

This is running against BrowserStack on a Samsung Galaxy S21 Ultra. It appears to be related to switching contexts to Native before.

Environment

  • Java client build version or git revision if you use some snapshot: 8.0.0-beta
  • Appium server version or git revision if you use some snapshot: BrowserStack
  • Desktop OS/version used to run Appium if necessary: BrowserStack
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: N/A
  • Mobile platform/version under test: Galaxy S21 Ultra on BrowserStack
  • Real device or emulator/simulator: Real

Code To Reproduce Issue [ Good To Have ]

driver.getScreenshotAs(OutputType.BYTES)

Exception Stacktraces

See above

Link To Appium Logs

I would be happy to send a link to the BrowserStack Appium logs directly, but it appears to include some of the credential information, so I wouldn't want to post it here. I've seen other references to this problem in other tickets though, so I'm assuming this isn't a new problem.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs, especially the handling associated with the reported failure at RemoteWebDriver.java:357. Reproduce driver.getScreenshotAs(OutputType.BYTES) after switching to Native context on the reported Android setup, then verify that the screenshot command returns a byte array rather than Maps$TransformedEntriesMap.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.