I am trying to automate a Visual Basic Application using pywinauto, with backend="win32". I am able to handle everything except selecting an item from one of the comboboxes. This particular combobox is dependent upon the selection of another combobox
Here is the code:
app.ThunderRT6MDIForm.xxxxx.ComboBox3.select("abc") # this correctly selects from the combobox
app.ThunderRT6MDIForm.xxxxx.ComboBox4.select(1) #This one gives error
And the error for the same:
IndexError: Combobox has 0 items, you requested item 1 (0 based)
Control Identifiers return :
ComboBox - 'abc' (L136, T206, R376, B227)
| ['ComboBox3', 'abc co-brandingComboBox2']
| child_window(title="abc", class_name="ThunderRT6ComboBox")
|
| | Edit - '' (L139, T234, R356, B249)
| | ['abc co-brandingEdit10', 'Edit12']
| | child_window(class_name="Edit")
ComboBox - '' (L136, T157, R376, B178)
| ['4', 'ComboBox4']
| child_window(class_name="ThunderRT6ComboBox")
| |
| | Edit - '' (L139, T160, R356, B175)
| | ['5', 'Edit14']
| | child_window(class_name="Edit")
I have found a temporary workaround for this problem. I was able to find that pressing Alt + Down key opened the combobox and gave me the list. So, I have used the same logic in code as well and it worked!
app.ThunderRT6MDIForm.xxxxx.ComboBox4.Edit14.type_keys("%{DOWN}")
app.ThunderRT6MDIForm.xxxxx.ComboBox4.select("item")