How to get a combobox item ? Delphi form : Automation API

How to get a combobox item ? Delphi form

Class library usage, coding and language questions.

How to get a combobox item ? Delphi form

Postby claudio.souza » Thu Nov 13, 2008 1:27 pm

Im working in a project for automating tests for an application made in Delphi. (version unknow)

With the Ranorex spy i can get the classname of the desired combo (TDBLookupComboBox) and also got the name of the list class (TPopupDataList).

How can i get the selected text ?

I'm using Ranorex 1.5 and VB.Net.
claudio.souza
 
Posts: 6
Joined: Fri Nov 07, 2008 1:11 pm

Postby Support Team » Fri Nov 14, 2008 2:11 pm

How can i get the selected text ?


Normally, you can read the selected text of the combo as follows:
(The selected text is the value of the combo element.)

Code: Select all
ComboBox comboBox = form.FindComboBox("comboBox1");
Element comboElement = comboBox.Element.FindChild(Role.ComboBox);
String comboValue = comboElement.Value;
Console.WriteLine("Combo value= {0}", comboValue);


Jenö
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4289
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

the problem is name

Postby claudio.souza » Mon Nov 17, 2008 6:08 pm

the problem is that i can't get the combobox name...
claudio.souza
 
Posts: 6
Joined: Fri Nov 07, 2008 1:11 pm

Postby Support Team » Mon Nov 17, 2008 6:29 pm

the problem is that i can't get the combobox name...


OK, you can also find the combo by class name:

Code: Select all
ComboBox comboBox = (ComboBox)form.FindClassName("TDBLookupComboBox");
Element comboElement = comboBox.Element.FindChild(Role.ComboBox);
String comboValue = comboElement.Value;
Console.WriteLine("Combo value= {0}", comboValue);


Please use also the second argument of the function FindClassName (instanceNumber) if you have more than one combo in your form.

Jenö
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4289
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 1 guest