Select a list item from a combobox
Posted: Tue Mar 17, 2009 12:22 pm
Hi there,
I can't select a list item from a regular .net combobox. Here's the code I used:
The list item never gets into the "Selected" state, not even when explicitly set, therefore i cannot proceed with the automation process.
Can someone help me on this?
Thank you very much,
Carla Neves
I can't select a list item from a regular .net combobox. Here's the code I used:
Code: Select all
Ranorex.ComboBox ComboBox = "/form[@controlname='FRM_Main']/container/element/*/*/container[@caption='' and @processname='MyApplication' and @controltypename='WindowDockingArea' and @class='WindowsForms10.Window.8.app.0.11c7a8c' and @instance='0']/container[@caption='' and @processname='MyApplication' and @controltypename='DockableWindow' and @class='WindowsForms10.Window.8.app.0.11c7a8c' and @instance='0']/*/container[@controlname='panel1']/element[@controlname='comboSite']/*/combobox";
// Open combobox by clicking the
// drop down button
Ranorex.Button open = ComboBox.FindChild<Ranorex.Button>("Open");
open.Click();
// Select list item
// from DropDown list
ListItem listItem = ComboBox.FindSingle<ListItem>
("/form[@controlname='FRM_Main']/container/element/*/*/container[@caption='' and @processname='MyApplication' and @controltypename='WindowDockingArea' and @class='WindowsForms10.Window.8.app.0.11c7a8c' and @instance='0']/container[1]/*/container[@controlname='panel1']/element[@controlname='comboSite']/combobox/*/list/listitem[@accessiblename='4270' and @accessiblerole='ListItem' and @text='4270' and @index='12']");
listItem.Click();
Can someone help me on this?
Thank you very much,
Carla Neves