[KShare] How to capture and interact on items of Dropdown List

Hi Community members, :wave:

Today, we are back with a new articles on Desktop Testing with Katalon!

Have you ever been frustrated when trying to capture and interact with items in a dropdown list?

As the dropdown list’s items are in a separate window, we cannot capture or interact with them directly but need to perform some extra steps like switching to a desktop and switching to a separate window containing the list of dropdown list’s items.

Let us share with you a scenario and how to work around it.

Scenario

  1. Try to capture items of a dropdown list in a desktop application.
  2. Try to click on an item in a dropdown list in a desktop application.

Issues & Solutions

1. Cannot capture items of the dropdown list

Do you use the “Windows Action Recorder“? If yes, please use the “Native Windows Recorder“ instead.

Windows Action Recorder will use all methods of Appium to capture and interact with desktop elements. There will be some limitations like capturing dropdown list items.

Aware of those limitations, Katalon developed a new function named “Native Windows Recorder“ to cover most of the cases.

See a comparison between Windows Action Recorder and Native Windows Recorder below :point_down:

Windows Action Recorder

Native Windows Recorder

2. Cannot interact with items of the dropdown list when executing the test

As explained above, we need to perform extra steps to interact with items in the dropdown list since they belong to a separate window.

So, what are the extra steps?

  1. Switch to Desktop where we can find or interact with other available Windows applications.
  2. Interact with the item in the dropdown list.

Note: Since the items list is shown on a window without a title, so we need to make sure that the system can find the item correctly based on the defined locator.

For example, instead of using the xPath locator /List/Listitem[2]

we should use another locator like Name with a specific value like VNI

  1. Switch back to the application to continue performing actions on other objects

We would love to provide you - our community users - with the custom keyword below to save time…

	@Keyword
	def clickDropdownItem(WindowsTestObject windowsObject) {
		Windows.switchToDesktop();
		Windows.click(windowsObject);
		Windows.switchToApplication();
	}

Result


If you find this article helpful, then don’t forget to leave us a like :+1: or a heart :heart:, and share it with your colleagues, to show your support!

:information_source: To read other KShare articles, simply navigate to our Product Insights category.

2 Likes

Thank you very much to the Product Support team (@support.squad), Linh Nguyen (@linh.nguyen), and Thong Tran (@thong.tran) for another helpful article on Desktop Testing!

Linh Nguyen Thong Tran
Linh Nguyen (@linh.nguyen) - Product Support Manager at Katalon Thong Tran (@thong.tran) - Senior Software Engineer at Katalon
Linh is the Product Support team Manager at Katalon. She spent many years working as an Automation Testing QA before joining Katalon Product Support as a technical support expert. Based on her experiences, she usually provides consumers with highly applicable solutions. She now manages her team with a user-centric approach to guarantee customers greater success with Katalon Products. A passionate Katalon developer with a wealth of programming and testing expertise. Thong has been dedicated to providing exceptional enterprise support for the past five years, helping Katalon’s customers achieve their testing goals with ease.
1 Like