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);
Unable to select a drodown list item
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
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
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
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
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
If you could send us a sample application where this problem occurs, we can try to figure out whats wrong.
Michael
Ranorex Support Team
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
DevExpress Combobox
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:
(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
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));
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