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

classNameMatches doesn't return all results #473

Open
gavrix opened this issue May 27, 2022 · 3 comments
Open

classNameMatches doesn't return all results #473

gavrix opened this issue May 27, 2022 · 3 comments

Comments

@gavrix
Copy link

gavrix commented May 27, 2022

Observing strange behaviour where selectors new UiSelector().className("android.view.ViewGroup") and new UiSelector().classNameMatches("android.view.ViewGroup") would return drastically different results (17 elements vs 5)

After some digging I found this issue appium/appium#5924 which has been reported toward UiAutomator1 driver, however, based on the source code in this repo, it's still present.

@KazuCocoa
Copy link
Member

Could you share the appium log?
Did you call it via -android uiautomator locator?

The query calls https://developer.android.com/reference/androidx/test/uiautomator/UiSelector method directly, so the result depends on how Android OS handles it.

@gavrix
Copy link
Author

gavrix commented May 28, 2022

As described in the original issue, it actually doesn't translate directly to UiSelector calls. This is the piece of code which handles class_regex selectors https://github.com/appium/appium-uiautomator2-server/blob/master/app/src/main/java/io/appium/uiautomator2/utils/ByUiAutomatorFinder.java#L101-L123

As described in the original issue, the useIndex part is confusing and what's probably broken.

@KazuCocoa
Copy link
Member

I see, thank you. I'll take a look

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