Skip to content

Expose AutomationId as resource-id for Android automation - #21780

Merged
MrJul merged 1 commit into
AvaloniaUI:mainfrom
stevemonaco:fix-android-automation-properties
Jul 15, 2026
Merged

Expose AutomationId as resource-id for Android automation#21780
MrJul merged 1 commit into
AvaloniaUI:mainfrom
stevemonaco:fix-android-automation-properties

Conversation

@stevemonaco

Copy link
Copy Markdown
Contributor

What does the pull request do?

Adds uiautomator visibility to AutomationProperties.AutomationId to Android.

What is the current behavior?

Android automation tree does not have the automation id available.

What is the updated/expected behavior with this PR?

Tested with ControlCatalog.Android on a physical device with only the XAML changes below. When using automation properties such as:

<Button
	AutomationProperties.AutomationId="NoBorderButtonTestId"
	AutomationProperties.HelpText="A button with no border"
	AutomationProperties.Name="NoBorderButtonTestName"
	BorderThickness="0"
	IsEnabled="False">
	No Border
</Button>

resource-id is now populated (previously empty) when dumping the automation tree with: adb exec-out uiautomator dump /dev/tty

<node index="0" text="NoBorderButtonTestName" resource-id="NoBorderButtonTestId" class="Button" package="com.Avalonia.ControlCatalog" content-desc="A button with no border" checkable="false" checked="false" clickable="true" enabled="false" focusable="true" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[573,506][794,585]" drawing-order="0" hint="">

How was the solution implemented (if it's not obvious)?

Assigns AutomationProperties.AutomationId to AccessibilityNodeInfoCompat.ViewIdResourceName

Checklist

Breaking changes

None expected. Didn't notice any restrictions on string length or character set.

Obsoletions / Deprecations

None

Fixed issues

None

Background

We're evaluating using Maestro for Android end-to-end testing on physical devices. This works, but matching based on text or content-desc is not ideal.

iOS, too, when accessibility is implemented there.

@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.2.999-cibuild0067468-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added enhancement area-accessibility backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Jul 15, 2026

@MrJul MrJul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MrJul
MrJul added this pull request to the merge queue Jul 15, 2026
Merged via the queue into AvaloniaUI:main with commit 0bf2e4d Jul 15, 2026
11 checks passed
@stevemonaco
stevemonaco deleted the fix-android-automation-properties branch July 28, 2026 16:01
MrJul pushed a commit that referenced this pull request Jul 29, 2026
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants