maui: [Android] AutomationId no longer works
Description
When AutomationId is set to any MAUI element\view it is not set as a ContentDescription to the Android element\view. You can find project showing the issue here: https://github.com/GeorgeDarakchiev/ReproProjects/tree/main/AutomationIdRepro/AutomationIdRepro
It seems like it is caused by PR: #3835 where there is
else if (info.ContentDescription == virtualView.AutomationId) info.ContentDescription = null;
Anyway, this leads to UI Automation frameworks (like Appium) not being able to locate elements by Automaton\Accessibility Id (depending on the naming in the framework).
In this image you can see on the left how it was before, and on the right how it is now (no content description)

Steps to Reproduce
- Run the app from here: https://github.com/GeorgeDarakchiev/ReproProjects/tree/main/AutomationIdRepro/AutomationIdRepro
- Use any automation tool like Appium to check the content description.
Version with bug
Preview 12 (current)
Last version that worked well
Preview 11
Affected platforms
Android
Affected platform versions
All
Did you find any workaround?
As a workaround SemanticProperties.Description can be set, but this leads to issues on iOS.
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (9 by maintainers)
Yes, it works in the project.
I can confirm that contend-description is set with the AutomationId from the App.
Also you can easily inspect the app without having to create tests or some fancy Appium setup.
You just need to follow the steps below:
Then you will be able to inspect the app and see the tree, whether elements have content description and search for elements.