Forum Discussion
The code that you have provided only shows the name mapping, but you're not performing any action. You should be either calling the method Click() or ClickItem("ItemX"). For example,
Aliases.FramingStylesEditor.WPFObject("HwndSource: PopupRoot", "").WPFObject("PopupRoot", "", 1).WPFObject("Decorator", "", 1).WPFObject("NonLogicalAdornerDecorator", "", 1).WPFObject("GroupItem", "", 2).WPFObject("ComboBoxItem", "", 2).WPFObject("TextBlock", "OSB 7/16", 1).Click();
or, if "OSB 7/16" is the item that you want to select, then it's
Aliases.FramingStylesEditor.WPFObject("HwndSource: PopupRoot", "").WPFObject("PopupRoot", "", 1).WPFObject("Decorator", "", 1).WPFObject("NonLogicalAdornerDecorator", "", 1).WPFObject("GroupItem", "", 2).WPFObject("ComboBoxItem", "", 2).ClickItem("OSB 7/16");
Hi,
I've add step to perform action, but it still doesn't work
- Below is the code:
function cboSelectWPF(inventoryType, value)
{
switch (inventoryType) {
case DEFAULT_BEAM: combobox = ddDefaultBeam ; break;
case DEFAULT_SHEET: combobox = ddDefaultSheet ; break;
case BOTTOM_PLATE: combobox = ddBottomPlate ; break;
case SPACING_BEAMS: combobox = ddSpacingBeams ; break;
case TOP_PLATE: combobox = ddTopPlate ; break;
}
combobox.ClickItem(value);
}
combobox is dropdown list with object in the screenshot
- Here is the properties of dropdown object. Could you pls check?
--------------------
Also I tried another way by expanding the dropdown menu then selecting a value but it didn't work.
I see the drop down menu expanded but can't select a value.
here is the script that I used to expanded the dropdown, then select the value with Click() function
function cboSelectWPF(inventoryType)
{
switch (inventoryType) {
case DEFAULT_BEAM: combobox = ddDefaultBeam ; break;
case DEFAULT_SHEET: combobox = ddDefaultSheet ; break;
case BOTTOM_PLATE: combobox = ddBottomPlate ; break;
case SPACING_BEAMS: combobox = ddSpacingBeams ; break;
case TOP_PLATE: combobox = ddTopPlate ; break;
}
combobox.Click();
aqUtils.Delay(1000);
tb2x4.Click();
}
combobox.Click(): to expand the dropdown list
tb2x4.Click(): select with the value 2x4 from dropdown list
- rraghvani2 days ago
Champion Level 3
First - get the name mapping of this control,
Use either full name or alias name mapping for this control.Second - then perform object.ClickItem("2 X 4") to select the desired item shown in the list,
ClickItem("2 X 4")Where object is the name mapping of the control, and assuming "2 X 4" is the item to be selected. Note the list of items shown, might be a custom control, as combo control usually just has list of items. But in this instance, it's showing labels as well i.e. "Lumber Inventory" and "Sheet Inventory".
I suggest you try the example code, that I had originally provided (not using cboSelectWPF), to check the functionality of ClickItem() actually works for you. Also, since this is a WPF object, there may be a method that you can use, shown in the Methods tab.
FYI. Your alias name is way to long - refer to Name Mapping