Search code examples
reactjsappiumappium-androidinspector

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

  • driver.FindElementByAndroidUIAutomator("UiSelector().text(\"WHATEVER TEXT\")").Click();

    Thanks to @Dmitri T's reply, I've used Appium Studio to inspect the elements - which I couldn't inspect before due to the splash screen (I guess). Later on, I was still unable to find elements by XPath and other methods, again - probably because of the splash screen.

    What finally did the trick, was using FindElementByAndroidUIAutomator. Got a list of usages here, and finally I'm able to find and click.

    I understand that the solution is a bit different than my original question's title - but these 2 methods (Appium studio + FindElementByAndroidUIAutomator) provided the solution for my problem.