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

Attempt to invoke virtual method 'void android.view.accessibility.AccessibilityWindowInfo.getBoundsInScreen(android.graphics.Rect)' on a null object reference #534

Open
GeneraalGarnaal opened this issue Sep 21, 2023 · 1 comment

Comments

@GeneraalGarnaal
Copy link

Issue

In some cases when trying to locate an element by xPath we run into the following issue.
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.accessibility.AccessibilityWindowInfo.getBoundsInScreen(android.graphics.Rect)' on a null object reference

The issue originates in the AxNodeInfoHelper.java class.
if (node.getWindow() != null) {
node.getWindow().getBoundsInScreen(window);
ret.intersect(window);
}
Between two node.getWindow() calls the AccessibilityWindowInfo becomes null.

Stacktrace

https://gist.github.com/GeneraalGarnaal/72fa7ac55e7038ffb56974c7d03ddb6d#file-gistfile1-txt

Reproducibility

We are using io.appium.uiautomator2.server version 4.12.2.
I realise that this is an older version but the problematic code is still present in the newest version.

I have not been able to reproduce it on a local setup because the issue does not happen consistently.
It depends on the timing of the AccessibilityWindowInfo changing.

The issue has happened on different devices but mostly on a Samsung Galaxy A13 running Android 13.

This has also been reported earlier: appium/appium#11513 (comment).

Thank you in advance! Let me know if you need some extra information.

@mykola-mokhnach
Copy link
Contributor

This could be a race condition. Lets see if #535 helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants