Skip to content

Commit 27b6362

Browse files
author
KB Bot
committed
Added new kb article automated-tapping-dropdown-items-telerik-maui
1 parent 48023ad commit 27b6362

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Automated Tapping on Dropdown Items in Telerik Controls for UI for .NET MAUI
3+
description: Addressing issues with automated testing of dropdown items in ComboBox and AutoComplete using Appium.
4+
type: troubleshooting
5+
page_title: Issues with Automated Tapping on Dropdown Items in Telerik MAUI Controls
6+
meta_title: Automated Testing Issues with Dropdown Items in Telerik MAUI Controls
7+
slug: automated-tapping-dropdown-items-telerik-maui
8+
tags: ui for .net maui, automation, radcombobox, radautocomplete, radpopup, appium, dropdown, testing, automationid
9+
res_type: kb
10+
---
11+
12+
## Environment
13+
14+
| Version | Product | Author |
15+
| --- | --- | ---- |
16+
| 12.0.0 | Telerik UI for .NET MAUI ComboBox and AutoComplete | [Dobrinka Yordanova](https://www.telerik.com/blogs/author/dobrinka-yordanova) |
17+
18+
## Description
19+
20+
I encountered issues performing automated UI testing with Appium for Telerik UI for .NET MAUI controls that use dropdowns, such as [ComboBox](https://www.telerik.com/maui-ui/documentation/controls/combobox/overview) and [AutoComplete](https://www.telerik.com/maui-ui/documentation/controls/autocomplete/overview). The dropdown or suggestion view in these controls uses the `RadPopup` control, which is not visible in `UIAutomator`, affecting Appium testing on Android.
21+
22+
## Cause
23+
24+
The issue arises because the `RadPopup` control is not visible in the UI tree due to a problem with UIAutomator, as noted in the related [Google issue tracker](https://issuetracker.google.com/issues/37017411?pli=1). Additionally, making the popup focusable is not a viable solution as it interferes with the functionality of the dropdown controls.
25+
26+
## Solution
27+
28+
To automate tapping on dropdown items, use the following workaround:
29+
30+
1. Calculate the coordinates for tapping based on the default height of a dropdown item, which is `32` pixels.
31+
2. Use Appium's coordinate-based tap functionality to simulate tapping on the desired item.
32+
33+
Below is an example approach for automation using internal methods and Appium:
34+
35+
```csharp
36+
case FindBy.AutomatiomationId:
37+
appiumStrategy = MobileBy.AccessibilityId(locator); break;
38+
case FindBy.XPath:
39+
appiumStrategy = By.XPath(locator); break;
40+
case FindBy.ClassName:
41+
appiumStrategy = By.ClassName(locator); break;
42+
case FindBy.Name:
43+
appiumStrategy = By.Name(locator); break;
44+
```
45+
46+
### AutomationId Limitations
47+
48+
Be aware of the following issues with AutomationId:
49+
50+
- **Android**: AutomationId does not work ([GitHub issue](https://github.com/dotnet/maui/issues/8277)).
51+
- **Windows**: AutomationId does not work for `ContentView`, `Layouts`, and controls inheriting them ([GitHub issue](https://github.com/dotnet/maui/issues/4715)).
52+
53+
### Workaround for AutomationId
54+
55+
Use the `SetAutomationIds()` method from the [sample application](https://github.com/telerik/maui-samples/blob/main/Samples/AppUtils/Services/Testing/TestingExtensions.cs) provided by Telerik to address AutomationId issues.
56+
57+
## See Also
58+
59+
- [Google UIAutomator Issue](https://issuetracker.google.com/issues/37017411?pli=1)
60+
- [AutomationId Issue on Android](https://github.com/dotnet/maui/issues/8277)
61+
- [AutomationId Issue on Windows](https://github.com/dotnet/maui/issues/4715)
62+
- [Sample Application for MAUI](https://github.com/telerik/maui-samples/blob/main/Samples/AppUtils/Services/Testing/TestingExtensions.cs)

0 commit comments

Comments
 (0)