Skip to content
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

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

Closed
2 tasks done
zach-fetch opened this issue Oct 2, 2024 · 18 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@zach-fetch
Copy link

Is this an issue specifically with Appium Inspector?

  • I have verified that my issue does not occur with Appium, and should be investigated as an Appium Inspector issue

Is there an existing issue for this?

  • I have searched the existing issues

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

@zach-fetch zach-fetch added the bug Something isn't working label Oct 2, 2024
@eglitise
Copy link
Collaborator

eglitise commented Oct 2, 2024

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 eglitise added need info More information is needed from issue creator and removed bug Something isn't working labels Oct 3, 2024
@eglitise
Copy link
Collaborator

eglitise commented Oct 9, 2024

Closing due to no response

@eglitise eglitise closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
@eglitise eglitise removed the need info More information is needed from issue creator label Oct 9, 2024
@AlikShegidevich
Copy link

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.

[email protected] [installed (npm)]
Appium 2.6.0

Screenshot 2024-11-01 at 4 29 40 PM

appium.log

@AlikShegidevich
Copy link

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

@eglitise eglitise reopened this Nov 1, 2024
@eglitise eglitise added the bug Something isn't working label Nov 1, 2024
@eglitise
Copy link
Collaborator

eglitise commented Nov 1, 2024

@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
Copy link
Contributor

@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
Copy link
Collaborator

Closing due to no response

@eglitise eglitise closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2024
@sreejits139
Copy link

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

@eglitise eglitise reopened this Nov 19, 2024
@mykola-mokhnach
Copy link
Contributor

It might be a duplicate of appium/appium#20503 (comment)

@sreejits139
Copy link

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
Copy link
Contributor

I tried every option

What exactly did you try?

@sreejits139
Copy link

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
Copy link
Contributor

Try version 22.11.0

@sreejits139
Copy link

I installed the node 22.11.0, but I still get the same error. Can it be because of the app page itself as other pages are fine most of the times? Here is what I am doing:

  1. Start a local appium server.
  2. Start a local emulator in Android studio.
  3. Open Appium inspector.
  4. Once the app opens up, I click on the user icon on load a Sign in screen/overlay type of screen.
  5. Now, I need to find the selector for the Join element. So, I click on the refresh button on the inspector and I see the same error.
    Screenshot 2024-11-20 at 9 12 48 PM
    Thanks again for the support!!!

@eglitise
Copy link
Collaborator

@sreejits139 is this app publicly available? I would like to reproduce this on my end.

@eglitise
Copy link
Collaborator

eglitise commented Nov 21, 2024

My current guess is that this might be caused by the @xmldom/xmldom upgrade from 0.8.10 to 0.9.3. At the very least, the error message shown in the screenshot seems to be coming from xmldom.

@eglitise
Copy link
Collaborator

Ok, I think I can reproduce this by adding the unicode replacement character in the application DOM. With xmldom 0.8.10, it is being parsed without any issues.

@eglitise
Copy link
Collaborator

eglitise commented Dec 8, 2024

The issue should be fixed in version 2024.12.1. Thanks to everyone who reported it!

@eglitise eglitise closed this as completed Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants