Class to use for desktop element similar to webelement

Ask general questions here.
rsudhak
Posts: 118
Joined: Fri Jan 04, 2019 1:38 pm

Class to use for desktop element similar to webelement

Post by rsudhak » Fri Jan 04, 2019 1:53 pm

Hi,

I am working on a Desktop application using c#, and have a dropdown list element in my repository. I want to create a generic method to select an item based on the text and not by the index number from the drop-down. But unable to figure out what class the element belongs to as I am fairly new to Ranorex.

the sudo code should look like this:
private void selectTextFromDropdown(Webelement dropdown, string textToSelect) {
dropdown.click();
dropdown.selectByText(textToSelect);
}
The element in the repo looks like this :
container[@automationid='Main']//container[@automationid='ComponentSettingsView']/container/container/element[@automationid='PageContentControl']//container[@automationid='CableTypeViewElement']/?/?/list[@automationid='CableTypeComboBox']

Please note that this is desktop application so can't use Webelement, want to find what class will the dropdown belong to and how would I directly select from the list based on text without using a for loop to loop through each element in the list.

Thanks,
Rajee

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Class to use for desktop element similar to webelement

Post by qwertzu » Mon Jan 07, 2019 1:30 pm

hi rsudhak,

First of all, I would recommend using normal Ranorex action instead of code which makes your test way more organized maintainable.
Have you already tried to simply record a click on this dropdown element with the Ranorex Recorder and taken a look at the paths that Ranorex automatically created?
However, in order to help you finding a good way to achieve your goal, please upload a Ranorex Snapshot of your application.

regards, qwertzu