'How to get Appium's inspector to refresh its UI on an Android Native App?

Appium inspector is stuck with its loading animation in the UI section, not allowing to get the current UI and elements. How can it by bypassed?

I'm running Appium 1.13.0 on Windows, with a real Android device and trying to inspect a React native app. The inspector launches the app and shows the initial screen (environment chooser) and allows to inspect/select elements, but after tapping - it shows a loading animation which doesn't stop. Attempting to refresh does nothing. On the device itself - the app has reached the desired screen.

From Appium's logs, here's what happens after the tap:

[MJSONWP (6564ecbb)] Responding to client with driver.click() result: true

[HTTP] <-- POST /wd/hub/session/6564ecbb-53f5-4c97-8456-f70f6ea3d747/element/1/click 200 141 ms - 76

[HTTP] 

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}

[HTTP] --> GET /wd/hub/session/6564ecbb-53f5-4c97-8456-f70f6ea3d747/source

[HTTP] {}

[MJSONWP (6564ecbb)] Calling AppiumDriver.getPageSource() with args: ["6564ecbb-53f5-4c97-8456-f70f6ea3d747"]

[HTTP] --> GET /wd/hub/session/6564ecbb-53f5-4c97-8456-f70f6ea3d747/screenshot

[HTTP] {}

[MJSONWP (6564ecbb)] Calling AppiumDriver.getScreenshot() with args: ["6564ecbb-53f5-4c97-8456-f70f6ea3d747"]

[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"source","params":{}}

[HTTP] --> GET /wd/hub/session/6564ecbb-53f5-4c97-8456-f70f6ea3d747/window/current/size

[HTTP] {}

[MJSONWP (6564ecbb)] Calling AppiumDriver.getWindowSize() with args: ["current","6564ecbb-53f5-4c97-8456-f70f6ea3d747"]

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"source","params":{}}

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: source


Solution 1:[1]

It seems that Appium Inspector has troubles getting the page source, try restarting the device/Appium Desktop and make sure nothing else is using the adb connection.

You can also consider using alternative tools which provide device UI inspection capabilities:

  1. Android Studio Layout Inspector
  2. Android Device Monitor
  3. Appium Studio

Solution 2:[2]

Use can use refresh button in appium Desktop inspector to refresh the screen displyaed. You can see the refresh button in top side as shown in following figure.enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T
Solution 2 Suban Dhyako