The display properties dialog is an old windows control, it's not a .NET control so it has no control names.
You can only use the FormFindChildClassName and FormFindChildControlId functions to find a control in the form. You can also use the element functions to find the elements in the tab pages.
The following code finds and activates the 'Display Properties' dialog, reads and activates all tabs, searches the 'Display' element and reads the text of it.
Code: Select all
...
form = Ranorex.FormFindTitle('Display Properties')
if form == 0:
print 'Error: Form not found'
return 4
print ' Form found, form=' + hex(form)
print '--------------------------------------------------------------------'
print ' Searching and testing a tab control'
print '---------------------------------------------------------------------'
print ' Searching tabControl1 by control name'
tabControl = Ranorex.FormFindChildClassName(form,'SysTabControl32')
if tabControl == 0:
print 'ERROR: tabControl1 not found'
return 5
print ' tabControl=' + hex(tabControl)
print ' Moving the mouse to the tab control'
Ranorex.MouseMoveToControl(tabControl)
selectedIndex = Ranorex.TabControlGetSelectedIndex(tabControl)
if selectedIndex != -1:
print ' SelectedIndex=' + str(selectedIndex)
selectedText = Ranorex.TabControlGetSelectedText(tabControl)
if selectedText != None:
print ' SelectedText=' + str(selectedText)
itemCount = Ranorex.TabControlGetItemCount(tabControl)
print ' ItemCount=' + str(itemCount)
for i in range(itemCount):
text = Ranorex.TabControlGetItemText(tabControl,i)
print ' Tabtext ' + str(i) + '=' + text
Ranorex.TabControlSetSelectedIndex(tabControl,i)
Ranorex.Sleep(1000)
element = Ranorex.ControlGetElement(form)
display = Ranorex.ElementFindChild(element, Ranorex.ROLE_SYSTEM_STATICTEXT, 'Display:', 'ComboBox')
if display == None:
print 'ERROR: display not found'
return 5
Ranorex.MouseMoveToElement(display)
print Ranorex.ElementGetValue(display)
Use RanorexSpy to get the control and element properties.
Jenö Herget
Ranorex Team