Improvements in Automating Syncfusion Xamarin.Forms Controls Using Automation ID | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (181).NET Core  (28).NET MAUI  (227)Angular  (113)ASP.NET  (49)ASP.NET Core  (81)ASP.NET MVC  (87)Azure  (42)Black Friday Deal  (1)Blazor  (236)BoldSign  (14)DocIO  (24)Essential JS 2  (110)Essential Studio  (200)File Formats  (73)Flutter  (136)JavaScript  (226)Microsoft  (122)PDF  (83)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (964)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (46)Webinar  (53)Windows Forms  (59)WinUI  (72)WPF  (163)Xamarin  (159)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (11)Business intelligence  (55)Button  (4)C#  (164)Chart  (147)Chart of the week  (58)Cloud  (15)Company  (440)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (73)Development  (681)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (13)Excel  (43)Extensions  (23)File Manager  (7)Gantt  (21)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (522)Mobile MVC  (9)OLAP server  (2)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (45)Performance  (13)PHP  (2)PivotGrid  (5)Predictive Analytics  (6)Report Server  (3)Reporting  (8)Reporting / Back Office  (9)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (5)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (32)Solution Services  (4)Spreadsheet  (11)SQL  (15)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (406)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (628)What's new  (341)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Automating Syncfusion Xamarin.Forms Controls using Automation Ids

Improvements in Automating Syncfusion Xamarin.Forms Controls Using Automation ID


When creating a Xamarin.Forms app, it’s important to provide an accessible one that meets all the requirements and all the experiences of a wide range of people around the world. So, it is crucial to consider this accessibility checklist when developing a Xamarin.Forms app. We at Syncfusion understand the accessibility needs of various people and developers, and we are endeavoring to deliver seamlessly accessible controls. As a part of this, we are stepping up to provide complete automation support to our Syncfusion Xamarin.Forms controls in our 2019 Vol 3 release.

In this blog, we’ll see how easy it is to automate our Syncfusion Xamarin.Forms controls.

What is AutomationId in Xamarin.Forms?

AutomationId is a property of the Element class that gets or sets a string value that allows the automation framework to find and interact with elements using the value.

How to set AutomationId to controls

Since AutomationId is a property of an element, controls like Button can inherit the property. You can assign any string to AutomationId for the Button control. The following code demonstrates how to set AutomationId to the Button control.

<Button AutomationId="Done Button"

Through this code, the automation framework will find and interact with the button using the value “Done Button”. Similarly, our other Syncfusion Xamarin.Forms controls, such as Cards, ListView, Busy Indicator, and Rating, have a direct AutomationId property that can interact with the automation framework. But some complex controls, such as DataGrid and Autocomplete, have several internal elements that don’t have public access to the automation framework. To rectify the problem, in the 2019 Vol 3 release, we provide unique AutomationIds to the internal elements that can interact with the automation framework. Let’s see how to set an AutomationId for Syncfusion Xamarin.Forms controls.

How to set AutomationId for Syncfusion controls

Syncfusion Xamarin.Forms controls and their elements will obey and interact with the automation framework. We provide unique AutomationIds for all accessible and interactable elements of a control. For example, in ComboBox, the automation framework can find and interact with elements such as a drop-down button, clear button, input field, drop-down item, and token clear button. So, we provide a unique AutomationId, and the automation framework can easily interact with this AutomationId. The following screenshot illustrates the defined AutomationId of the Xamarin.Forms ComboBox control.

Xamarin.Forms ComboBox with AutomationId
Xamarin.Forms ComboBox with AutomationId

Users will expect a unique AutomationId for all the interactable elements. To keep uniqueness, we kept the inner element of the AutomationId based on the control’s AutomationId, which is assigned by the user. Whenever the AutomationId of the control is changed, inner elements update their AutomationId based on the control’s AutomationId.

For example, if we set the AutomationId of ComboBox to “SfComboBox.AutomationId = “Employee ComboBox”, then the automation framework will interact with the drop-down button as “Employee ComboBox DropDown Button”.

Xamarin.Forms ComboBox with Unique AutomationId
Xamarin.Forms ComboBox with unique AutomationId

How does it work in an automation framework?

Let’s see how the Xamarin.UITest automation framework interacts with the Xamarin.Forms ComboBox. Here, I have a module to pick two teams using two Xamarin.Forms ComboBoxes containing lists of people. Now, I am automating the module by picking two teams using unique the AutomationIds of the ComboBox and its inner elements. The following code snippet demonstrates this.

Module with two ComboBoxes used to pick two teams.

   <Label Text="Team A"/>
   <combobox:SfComboBox AutomationId="TeamA"
                        DataSource="{Binding EmployeeCollection}"/>
   <Label Text="Team B"
   <combobox:SfComboBox AutomationId="TeamB"
                        DataSource="{Binding EmployeeCollection}"/>
   <Button Margin="0,100,0,0"

Interacting with the Xamarin.Forms ComboBox using the Xamarin.UITest commands.

App.Tap("TeamA Dropdown Button"); Thread.Sleep(200);
App.Tap("John"); Thread.Sleep(200);
App.Tap("TeamA Dropdown Button");
App.Tap("Jerome"); Thread.Sleep(200);
App.Tap("TeamA Dropdown Button"); Thread.Sleep(200);
App.Tap("Victoria"); Thread.Sleep(200);
App.ScrollTo("TeamA John"); Thread.Sleep(200);
App.Tap("TeamA John Token Close Button"); Thread.Sleep(200);
App.Tap("TeamB Dropdown Button");

App.Tap("Jessica"); Thread.Sleep(200);
App.Tap("TeamB Dropdown Button"); Thread.Sleep(200);
App.Tap("John"); Thread.Sleep(200);
App.Tap("TeamB Dropdown Button"); Thread.Sleep(200);
App.Tap("Justin"); Thread.Sleep(200);
App.ScrollTo("TeamB Jessica"); Thread.Sleep(200);
App.Tap("TeamB Jessica Token Close Button");


Xamarin.UITest interacting with Xamarin.Forms ComboBox
Xamarin.UITest interacting with Xamarin.Forms ComboBox

Note: If you are new to Xamarin.UITest, then you can get started with these instructions.

How can I get the AutomationId details of inner elements for all Syncfusion Xamarin.Forms controls?

We implement similar logic with all our controls, and the details of the internal elements can be found in the following help documents.

ControlsAutomationId help document links
Navigation Drawer
Radial Menu
Tabbed View
Segmented Control
Text Input Layout
Image Editor
PDF Viewer


In this blog post, we have walked through the new version of Syncfusion Xamarin.Forms controls that support AutomationId. We are still looking for possibilities to improve the automation support to automate our UI controls. We invite you to see all our Xamarin.Forms controls in action by downloading our free evaluation. You can also explore our samples available on Google Play and the Microsoft Store. Learn about the controls’ advanced features in our documentation.

If you have any questions about these controls, please let us know in the comments below. You can also contact us through our support forumDirect-Trac, or feedback portal. We are happy to assist you!


Share this post:

Comments (1)

For Synfusion SFScheduler, I need to be able to set the automationID for the inner element of today date to “Saturday 07/March/2020_Blue” so I can distinguish it from the other dates. How can I customize this?

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed