According to the program output, the right entry is being selected (see output), but the setting seems to have no effect (i.e. the previously set entry is still active).
According to the output on the screen a third entry (different from the previously set one and from the one to be set appears.
Here is the code, which has been basically copied from your Combobox example (self.Ranorex points to Ranorex):
- Code: Select all
print '---------------------------------------------------------------------'
print ' Searching and testing a ComboBox'
print '---------------------------------------------------------------------'
comboBox = self.Ranorex.FormFindChildClassName(self.form.window,
'ComboBox', 1)
if comboBox == 0:
print 'ERROR: ComboBox not found'
return
print ' comboBox = ' + hex(comboBox)
print ' moving the mouse to the ComboBox'
self.Ranorex.ControlSetFocus(comboBox)
self.Ranorex.ComboBoxHideDropDown(comboBox)
self.Ranorex.MouseMoveToControl(comboBox)
itemcount = self.Ranorex.ComboBoxGetItemCount(comboBox)
print ' itemcount=' + str(itemcount)
for i in range(itemcount):
text = self.Ranorex.ComboBoxGetItemText(comboBox, i)
if text == email:
if self.Ranorex.ComboBoxSetSelectedIndex(comboBox, i) == i:
print ' text=%s, index=%d set' % (text, i)
else:
print 'could not set selected Index %d in combo box' % i
break
else:
print ' text=%s' % text
else:
print 'Could not find entry %s in combo box' % text
Output:
---------------------------------------------------------------------
Searching and testing a ComboBox
---------------------------------------------------------------------
comboBox = 0x3801d2
moving the mouse to the ComboBox
itemcount=5
text=gerhard.kring@mincombj.com, index=0 set
clicked password Field
clicked Sign in Button