Page 1 of 1

Unable to select a drodown list item

Posted: Sat Jan 05, 2008 1:55 am
by sahoko
AUT: Windows app written in Delphi using DevExpress for UI controls

I recorded the action, and the recorder produced the code below. It replays fine. However when I try to do the same thing in my test code, the dropdown list closes right after it's clicked, and my test code fails to click a drodown list item:

Code generated by the recorder:
// Find child by class name
control = form.FindClassName("TomLookupCachedCombo", 5);
control.Focus();
Mouse.ClickControl(control, MouseButtonType.LeftButton, new Point(159, 9), 1, 100);

//-----------------------------------------------------------------
// Find form by title and class name
//-----------------------------------------------------------------
form = Application.FindForm("", SearchMatchMode.MatchExact, "ComboLBox", false, 5000);
formElement = form.Element;

// Find child element by Role=ListItem Name=DIR - Direct Business
element = formElement.FindChild(Role.ListItem, "DIR - Direct
Business", null);

Posted: Mon Jan 07, 2008 11:31 am
by Support Team
Unfortunately I cannot reproduce the problem with the standard Win32 or .NET comboboxes.
From your code, it looks like the Recorder tries to click your combobox control directly to open it.
Try using the Spy to check if the dropdown button on the combobox is available as an element, and then click the element instead of the control.

If that doesnt work please build a mini-example binary, and mail it to [email protected], as we dont use Delphi.

Michael
Ranorex Support Team

Posted: Mon Jan 07, 2008 6:29 pm
by sahoko
The spy tells me that the element has the role type of "Client". This element doesn't have a default action associated with it. Is there a function to click this element without any default action?

Posted: Tue Jan 08, 2008 10:31 am
by Support Team
It looks like the Delphi combobox is owner-drawn, and that there is a problem with the focus after clicking the control, because the drop-down is an independent top-level window.

If you could send us a sample application where this problem occurs, we can try to figure out whats wrong.

Michael
Ranorex Support Team

DevExpress Combobox

Posted: Fri Jan 11, 2008 11:47 am
by Support Team
I finally checked the DevExpress Delphi controls and it seems that most drop-down or combo boxes create client areas, where no further elements are available.

In your example, after clicking the combo box to open the popup, try using the following code, instead of clicking the element:

Code: Select all

 
form = Application.FindFormClassName("TcxComboBoxPopupWindow");
Mouse.ClickControl(form, MouseButtonType.LeftButton, new Point(10,10));
(where Point(x,y) can be any coordinates within the popup window.)

If that does not solve your problems, as a workaround when using comboboxes containing text I suggest using sendkey commands for selecting text, or using arrow up/down for traversing the list.

Michael
Ranorex Support Team