Appium seems to hang on Android when starting a new activity while a full screen animation is happening

I have an Android app that I’m testing with Appium (using python and robot framework).
However, sometimes Appium just stops, not an error message, not a timeout it just hangs for a very long time (longer than the 30s implicit wait I have set).

When I set a long wait, and manually go into another page and back again, (whilst appium is waiting) everything works again, but just going straight to the page doesn’t work. However, if the full screen loading animation is disabled it works fine.

It is not just about the full screen loading animation, because it works when the activity doesn’t change, but just the page (with the animation) this was tested by putting the problem page somewhere else in the app’s structure (where there wasn’t an activity change directly before in the navigation).

Has anyone else seen this behaviour? Is it a limitation of Appium itself or is it something unrelated?

In case it’s relevant, I’m running the appium server on Linux. Appium version 1.6.5, Android version 7.0.

If you open uiautomatorviewer and try to use it while the animation is present does it return an error?

Thanks for responding.
Yes, while the animation is present, uiautomatorviewer comes up with an error message:

Error obtaining UI heirarchy.

Reason: Error while obtaining UI heirarchy XML file:
com.android.ddmlib.SyncException: Remote object doesn’t exist!

That’s why appium cannot get the elements.

You can disable animations or try to identify elements coordinates before the animation and then interact using TouchActions only, etc… depending on your views, your automation requirements you need to try and adapt to that limitation. Also make sure you using uiautomator2

OK thanks.
Does this mean it is a more fundamental issue with the way Android handles animations and activities and the issue arises from before Appium gets its hands on it?
Which therefore means it would be the wrong place to raise a bug in Appium for the problem.

It seems that if I leave the animation to finish, then uiautomatorviewer can see the loaded page just fine. However, in Appium it still can’t see anything on the loaded page (even once the animation has gone). This seems to be where the discrepancy comes in.

After the animation ends, if you do driver.getPageSource() and query the page, it still cannot see anything?

That is correct, and more than Appium coming back with an error, it just hangs and waits for a very long time (much more than the implicit wait time).

If you try to perform some action while the animation lasts do they perform but take very long, or work only when there is no animation anymore? I have similar issue with video player in my app, but Im not sure if its the same.
In my case actions perform, but take very long. The player is paused for the sake of interacting with elements, because the standard 5 sec when buttons are visible is not enough, can I assume that there are no animations going on in this case?

This even happens after the animation has stopped.
It’s almost like when there’s something full screen happening when the activity changes, appium gets stuck on something and can’t then access the page later.

Does it perform action eventually (clicking on the element for example) if you wait long enough? Or is it frozen until you intervene manually?

Hello there…
I am running into the same problem here…
My current workaround is to press the app-switch key then opening the app again and it’s working…

But is there any other more effecient solution or workaround?

If you don’t want to wait for the animation to complete, just use the execute_script method
Looks like:
driver.execute_script(
‘mobile: shell’,
{
‘command’: f’input tap {x} {y}’,
})