Hi,
Having some problems getting anything in a combo box selected, in this instance via the WDP Power Options in windows:
def SetTimePeriod(self):
self.active = PropertyPage.PropertyPage()
self.active.SelectTab(POWER_OPTIONS_PROPERTIES, 0)
self.active.SelectComboboxItem(POWER_OPTIONS_PROPERTIES, "Home/Office Desk", 1)
which uses:
def SelectComboboxItem(self, parent, item, instance):
""" Requires the parent window’s title and the name of the combobox item """
""" i.e. SelectComboboxItem(“Display Properties”, "Medium (16 bit)") selects 16bit colour depth in the WDP """
form = Ranorex.FormFindTitle(parent)
ComboBox = Ranorex.FormFindChildClassName(form, 'ComboBox', instance)
Ranorex.ComboBoxSetSelectedText(ComboBox, item)
Please help if you can, what happens is the cursor is seen to move towards the required combo box, then stops at its border, nothing changes or happens and no errors are thrown.
Combobox selecting
It's better to use the FormFindChildControlId function in the standard windows dialogs.
(if the Id of the control is a unique identifier).
I tried the following code with the "Display Properties" Dialog and it worked for me:
Jenö
Ranorex Team
(if the Id of the control is a unique identifier).
I tried the following code with the "Display Properties" Dialog and it worked for me:
Code: Select all
comboBox = Ranorex.FormFindChildControlId(form,1807)
if comboBox == 0:
print 'ERROR: comboBox not found'
return
print ' comboBox = ' + hex(comboBox)
print ' moving the mouse to the comboBox'
Ranorex.MouseMoveToControl(comboBox)
itemcount = Ranorex.ComboBoxGetItemCount(comboBox)
print ' itemcount=' + str(itemcount)
for i in range(itemcount):
text = Ranorex.ComboBoxGetItemText(comboBox,i)
print ' text=' + str(text)
Ranorex.ComboBoxSetSelectedText(comboBox,text)
Ranorex Team