appium / appium-inspector

A GUI inspector for mobile apps and more, powered by a (separately installed) Appium server
https://appium.github.io/appium-inspector/
Other
1.21k stars 291 forks source link

bug: Call to getPageSource failed when call is returning a 200 (Android simulator) #1729

Open zach-fetch opened 1 month ago

zach-fetch commented 1 month ago

Is this an issue specifically with Appium Inspector?

Is there an existing issue for this?

Current Behavior

When I refresh the source and screenshot on our app I get an error that says Call to 'getPageSource' failed Unicode replacement character detected, source encoding issues?. This doesn't make sense because the getPageSource is returning a 200.

This is only an issue with Android and not an issue in iOS.

Appium Logging:

[HTTP] --> GET /wd/hub/session/2f9c6893-52a1-4a96-a9bf-c64400ff5a14/source {}
[AndroidUiautomator2Driver@7c85] Driver proxy active, passing request on via HTTP proxy
[AndroidUiautomator2Driver@7c85] Matched '/wd/hub/session/2f9c6893-52a1-4a96-a9bf-c64400ff5a14/source' to command name 'getPageSource'
[AndroidUiautomator2Driver@7c85] Proxying [GET /wd/hub/session/2f9c6893-52a1-4a96-a9bf-c64400ff5a14/source] to [GET http://127.0.0.1:8200/session/269aad1b-70be-4934-bc62-67428cca8392/source] with no body
[AndroidUiautomator2Driver@7c85] Got response with status 200: {"sessionId":"269aad1b-70be-4934-bc62-67428cca8392","value":"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<hierarchy index=\"0\" class=\"hierarchy\" rotation=\"0\" width=\"1440\" height=\"2891\">\r\n  <android.widget.FrameLayout index=\"0\" package=\"com.fetchrewards.fetchrewards.hop.debug\" class=\"android.widget.FrameLayout\" text=\"\" checkable=\"false\" checked=\"false\" clickable=\"false\" enabled=\"true\" focusable=\"false\" focused=\"false\" long-clickable=\"false\" password=\"false\" scrollable=\"false\" selected=\"false\" bounds=\"[0,0][1440,3120]\" displayed=\"true\">\r\n    <android.widget.LinearLayout index=\"0\" package=\"com.fetchrewards.fetchrewards.hop.debug\" class=\"android.widget.LinearLayout\" text=\"\" checkable=\"false\" checked=\"false\" clickable=\"false\" enabled=\"true\" focusable=\"false\" focused=\"false\" long-clickable=\"false\" password=\"false\" scrollable=\"false\" selected=\"false\" bounds=\"[0,0][1440,3120]\" displayed=\"true\">\r\n      <android.widget.Fra...
[AndroidUiautomator2Driver@7c85] Replacing sessionId 269aad1b-70be-4934-bc62-67428cca8392 with 2f9c6893-52a1-4a96-a9bf-c64400ff5a14
[HTTP] <-- GET /wd/hub/session/2f9c6893-52a1-4a96-a9bf-c64400ff5a14/source 200 76 ms - 75568

Expected Behavior

The getPageSource call should be processed and the app page should appear in appium inspector

Operating System

Mac

Appium Inspector Version

2024.9.1 (not an issue in appium 2024.3.4)

Appium Version

2.6.0

Further Information

Driver version

Simulator = Pixel 6 pro running Android 13

eglitise commented 1 month ago

Could you please provide the full Appium log? Would it also be possible for you to check the other Inspector versions between these two, to identify the first version with this issue?

eglitise commented 1 month ago

Closing due to no response

AlikShegidevich commented 2 weeks ago

Hi! The issue has been reproduced on Mac + Simulator Pixel 8 Pro Android 14: Appium Inspector 2024.9.1 Previous version 2024.8.2 doesn't have the issue. Log and screenshot are attached. Not all screens of our android app affected by the issue. Some of them can be inspected, some not. The log covers multiple attempts to Refresh different screens. Last two attempts failed.

uiautomator2@3.5.2 [installed (npm)] Appium 2.6.0

Screenshot 2024-11-01 at 4 29 40 PM

appium.log

AlikShegidevich commented 2 weeks ago

@eglitise Please reopen the bug - I've submitted the requested info

eglitise commented 2 weeks ago

@AlikShegidevich thanks for the info. Could you also try to reproduce this using https://inspector.appiumpro.com/ ? I would like to check whether the problem is specific to Electron, or affects both versions.

mykola-mokhnach commented 2 weeks ago

@eglitise The below lines look highly suspicious to me:

[HTTP] <-- GET /wd/hub/session/f5cdc235-2222-41e1-bba2-3b75c455ab8f/source 304 367 ms - - [HTTP] <-- GET /wd/hub/session/f5cdc235-2222-41e1-bba2-3b75c455ab8f/timeouts 304 135 ms - -

This looks like inspector is caching server responses, while it never should.

eglitise commented 5 days ago

Closing due to no response

sreejits139 commented 14 hours ago

I am still seeing the issue and not sure how to proceed. Can anyone please let me know if you found a solution for this? The issue happens on https://inspector.appiumpro.com/ too.

image
mykola-mokhnach commented 10 hours ago

It might be a duplicate of https://github.com/appium/appium/issues/20503#issuecomment-2357928628

sreejits139 commented 10 hours ago

I tried to compare but not sure if they are the same. I tried every option but somehow it errors out all the time say maybe I get lucky once in every 50 attempts!! Can you please let me know any alternative maybe to continue working.. Thanks for the help.

mykola-mokhnach commented 10 hours ago

I tried every option

What exactly did you try?

sreejits139 commented 9 hours ago

Node version: 20.61. - As most stable with webdriverio and appium. Started an emulator, started appium server, open the appium inspector and connect to an Android APK. After navigating to some pages that are like overlay pages, when I try to refresh the session on the inspector, it loads the 'Call to getPageSource failed' as above. Do you think I should try a newer version of Node? I had 23 but it was causing issues with webdriverio and appium so downgraded recently.

mykola-mokhnach commented 2 hours ago

Try version 22.11.0