Forum Xamarin Test Cloud (Read Only)

Allow Xamarin.UiTest to detect textual content on custom controls that don't implement TextView

Hi,

I would like to be able to adapt custom controls that do not derive from TextView so that their textual content can be picked up by Xamarin.UiTests's Calabash queries as well as the REPL. Since I know that the Accessibility API is what Xamarin uses to interface with the visual elements on Android, I thought that it would only be a matter of using that same Accessibility API to mark my custom control as having textual content, but I've had no success so far.

One reason behind my troubles is that the Android.Views.Accessibility namespace has a lot of operations/abstractions and it's not exactly clear what the procedure to add custom accessibility content consists of. I tried overriding the methods described in the Android accessibility how-to (ex: OnInitializeAccessibilityNodeInfo, OnInitializeAccessibilityEvent, etc.), but none of them ever get called, even after raising SendAccessibilityEvent.

Is it possible to use the accessibility API in such a way to accomplish what I want (in terms of UI automation)? If so, can someone provide a concise example of the logic required to make sure Xamarin.UiTests operations pick up the textual content of a custom control?

Thanks

Sign In or Register to comment.