WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

bug: appium server is showing 500 error when calling to get_screenshot_as_base64 while running Windows app test

Open bwomsm1 opened this issue 2 years ago • 5 comments

Windows Application Driver is 1.2.1.0

Current Behavior

While running windows app appium test, once I am calling to driver.get_screenshot_as_base64() I am getting the following error in appium server log:

[debug] [WindowsDriver@b02c (94a11461)] Calling AppiumDriver.getScreenshot() with args: ["94a11461-2ced-4895-b689-7cd4e44c6446"]
[debug] [WindowsDriver@b02c (94a11461)] Matched '/screenshot' to command name 'getScreenshot'
[debug] [WindowsDriver@b02c (94a11461)] Proxying [GET /screenshot] to [GET http://127.0.0.1:4724/wd/hub/session/B70CACF5-8A7E-4E2C-91BD-55B62AD131F1/screenshot] with no body
[debug] [WindowsDriver@b02c (94a11461)] ഀ਀ഀ਀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀ഀ਀䜀䔀吀 ⼀眀搀⼀栀甀戀⼀猀攀猀猀椀漀渀⼀䈀㜀 䌀䄀䌀䘀㔀ⴀ㠀䄀㜀䔀ⴀ㐀䔀㈀䌀ⴀ㤀㄀䈀䐀ⴀ㔀㔀䈀㘀㈀䄀䐀㄀㌀㄀䘀㄀⼀猀挀爀攀攀渀猀栀漀琀 䠀吀吀倀⼀㄀⸀㄀ഀഀ਀䄀挀挀攀瀀琀㨀 愀瀀瀀氀椀挀愀琀椀漀渀⼀樀猀漀渀Ⰰ ⨀⼀⨀ഀഀ਀䄀挀挀攀瀀琀ⴀ䔀渀挀漀搀椀渀最㨀 最稀椀瀀Ⰰ 挀漀洀瀀爀攀猀猀Ⰰ 搀攀昀氀愀琀攀Ⰰ 戀爀ഀഀ਀䌀漀渀渀攀挀琀椀漀渀㨀 欀攀攀瀀ⴀ愀氀椀瘀攀ഀഀ਀䌀漀渀琀攀渀琀ⴀ吀礀瀀攀㨀 愀瀀瀀氀椀挀愀琀椀漀渀⼀樀猀漀渀㬀 挀栀愀爀猀攀琀㴀甀琀昀ⴀ㠀ഀഀ਀䠀漀猀琀㨀 ㄀㈀㜀⸀ ⸀ ⸀㄀㨀㐀㜀㈀㐀ഀഀ਀唀猀攀爀ⴀ䄀最攀 渀琀㨀 愀瀀瀀椀甀洀ഀഀ਀ഀഀ਀ഀ਀
[debug] [WindowsDriver@b02c (94a11461)] 䠀吀吀倀⼀㄀⸀㄀ 㔀   䤀渀琀攀爀渀愀氀 䔀爀爀漀爀ഀഀ਀䌀漀渀琀攀渀琀ⴀ䰀攀渀最琀栀㨀 ㄀㌀㌀ഀഀ਀䌀漀渀琀攀渀琀ⴀ吀礀瀀攀㨀 愀瀀瀀氀椀挀愀琀椀漀渀⼀樀猀漀渀ഀഀ਀ഀഀ਀笀∀猀琀愀琀甀猀∀㨀㄀㌀Ⰰ∀瘀愀氀甀攀∀㨀笀∀攀爀爀漀爀∀㨀∀甀渀欀渀漀眀渀 攀爀爀漀爀∀Ⰰ∀洀攀猀猀愀最攀∀㨀∀䄀渀 甀渀欀渀漀眀渀 攀爀爀漀爀 漀挀挀甀爀爀攀搀 椀渀 琀栀攀 爀攀洀漀琀攀 攀渀搀 眀栀椀氀攀 瀀爀漀挀攀猀猀椀渀最 琀栀攀 挀漀洀洀愀渀搀⸀∀紀紀ഀ਀
[WindowsDriver@b02c (94a11461)] Got response with status 500: {"status":13,"value":{"error":"unknown error","message":"An unknown error occurred in the remote end while processing the command."}}
[debug] [W3C] Matched W3C error code 'unknown error' to UnknownError
[debug] [WindowsDriver@b02c (94a11461)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: An unknown error occurred in the remote end while processing the command.
[debug] [WindowsDriver@b02c (94a11461)]     at errorFromW3CJsonCode (C:\Users\qahw\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\errors.js:1040:25)
[debug] [WindowsDriver@b02c (94a11461)]     at ProxyRequestError.getActualError (C:\Users\qahw\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\errors.js:909:14)
[debug] [WindowsDriver@b02c (94a11461)]     at WADProxy.command (C:\Users\qahw\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\base-driver\lib\jsonwp-proxy\proxy.js:352:19)
[debug] [WindowsDriver@b02c (94a11461)]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[debug] [WindowsDriver@b02c (94a11461)]     at WinAppDriver.sendCommand (C:\Users\qahw\.appium\node_modules\appium-windows-driver\lib\winappdriver.js:223:12)
[debug] [WindowsDriver@b02c (94a11461)]     at WindowsDriver.getScreenshot (C:\Users\qahw\.appium\node_modules\appium-windows-driver\lib\commands\general.js:48:22)
[HTTP] <-- GET /session/94a11461-2ced-4895-b689-7cd4e44c6446/screenshot 500 27 ms - 1221
[HTTP]

Pay attention to these chars:

਀ഀ਀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀㴀ഀ਀䜀䔀吀 ⼀眀搀⼀栀甀戀⼀猀攀猀猀椀漀渀⼀䈀㜀 䌀䄀䌀䘀㔀ⴀ㠀䄀㜀䔀ⴀ㐀䔀㈀䌀ⴀ㤀㄀䈀䐀ⴀ㔀㔀䈀㘀㈀䄀䐀㄀㌀㄀䘀㄀⼀猀挀爀攀攀渀猀栀漀琀 䠀吀吀倀⼀㄀⸀㄀ഀഀ਀䄀挀挀攀瀀琀㨀 愀瀀瀀氀椀挀愀琀椀漀渀⼀樀猀漀渀Ⰰ ⨀⼀⨀ഀഀ਀䄀挀挀攀瀀琀ⴀ䔀渀挀漀搀椀渀最㨀 最稀椀瀀Ⰰ 挀漀洀瀀爀攀猀猀Ⰰ 搀攀昀氀愀琀攀Ⰰ 戀爀ഀഀ਀䌀漀渀渀攀挀琀椀漀渀㨀 欀攀攀瀀ⴀ愀氀椀瘀攀ഀഀ਀䌀漀渀琀攀渀琀ⴀ吀礀瀀攀㨀 愀瀀瀀氀椀挀愀琀椀漀渀⼀樀猀漀渀㬀 挀栀愀爀猀攀琀㴀甀琀昀ⴀ㠀ഀഀ਀䠀漀猀琀㨀 ㄀㈀㜀⸀ ⸀ ⸀㄀㨀㐀㜀㈀㐀ഀഀ਀唀猀攀爀ⴀ䄀最攀 渀琀㨀 愀瀀瀀椀甀洀ഀഀ਀ഀഀ਀ഀ਀
[debug] [WindowsDriver@b02c (94a11461)] 䠀吀吀倀⼀㄀⸀㄀ 㔀   䤀渀琀攀爀渀愀氀 䔀爀爀漀爀ഀഀ਀䌀漀渀琀攀渀琀ⴀ䰀攀渀最琀栀㨀 ㄀㌀㌀ഀഀ਀䌀漀渀琀攀渀琀ⴀ吀礀瀀攀㨀 愀瀀瀀氀椀挀愀琀椀漀渀⼀樀猀漀渀ഀഀ਀ഀഀ਀笀∀猀琀愀琀甀猀∀㨀㄀㌀Ⰰ∀瘀愀氀甀攀∀㨀笀∀攀爀爀漀爀∀㨀∀甀渀欀渀漀眀渀 攀爀爀漀爀∀Ⰰ∀洀攀猀猀愀最攀∀㨀∀䄀渀 甀渀欀渀漀眀渀 

Expected Behavior

Screen short from windows application should be captured successfully

Minimal Reproducible Example

driver.get_screenshot_as_base64()

Environment

  • Operating system: Windows 10 OS, 64 bit
  • Appium server version (output of appium --version): appium 2.0.0 RC3
  • Appium driver(s) and their version(s): [email protected] (automationName 'UiAutomator2')
  • Appium plugin(s) and their version(s): [email protected] (automationName 'UiAutomator2')
  • Node.js version (output of node --version): v18.12.0
  • npm version (output of npm --version): 8.19.2
  • Last component(s) version which did not exhibit the problem: never worked
  • Platform and version under test: Windows
  • Real device or emulator/simulator: real windows app

Link to Appium Logs

https://github.com/bwomsm1/AppiumLogs/blob/master/win_app_appium.log

Futher Information

No response

bwomsm1 avatar Jun 22 '23 08:06 bwomsm1

Windows Application Driver is 1.2.1.0

bwomsm1 avatar Jun 22 '23 08:06 bwomsm1

Any good reason that you want the image with base64?

anunay1 avatar Jun 22 '23 15:06 anunay1

Any good reason that you want the image with base64?

I am attaching the base64 data to html page, it has to be in base64.

bwomsm1 avatar Jun 23 '23 09:06 bwomsm1

Can you try taking normal screenshot without base64?

anunay1 avatar Jun 23 '23 09:06 anunay1

Can you try taking normal screenshot without base64?

@anunay1 what API you are suggesting? I see that also get_screenshot_as_png() is passing through get_screenshot_as_base64() which I am using today.

bwomsm1 avatar Jul 25 '23 08:07 bwomsm1