question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ComboBox Item_texts Issue when using MS UI Automation API

See original GitHub issue

When Win32 API is used, the item texts of the ComboBox can be retrieved successfully with the function ComboBox.item_texts().

But when MS UI Automation API is used, the actual item texts fail to return, but a blank value and “open” are got. When print control identifiers, there are two sub controls under the ComboBox. One is Edit, and the other is Down Button. Is it a bug of MS UI Automation API for ComboBox? Here is the identifiers info>

Pane - 'GCSS'    (L382, T99, R985, B630)
['GCSSPane', 'GCSS', 'Pane']
child_window(title="GCSS", control_type="Pane")
   | 
   | Dialog - 'Select User Profile'    (L494, T280, R873, B448)
   | ['Dialog', 'Select User Profile', 'Select User ProfileDialog']
   | child_window(title="Select User Profile", control_type="Window")
   |    | 
   |    | Edit - ''    (L583, T324, R855, B337)
   |    | ['', 'Edit', '0', '1', 'Edit0', 'Edit1']
   |    | child_window(auto_id="50001", control_type="Edit")
   |    | 
   |    | ComboBox - ''    (L583, T349, R855, B373)
   |    | ['2', 'ComboBox', 'ComboBoxClose']
   |    | child_window(auto_id="50002", control_type="ComboBox")
   |    |    | 
   |    |    | Edit - ''    (L586, T352, R835, B370)
   |    |    | ['3', 'Edit2']
   |    |    | child_window(auto_id="1001", control_type="Edit")
   |    |    | 
   |    |    | Button - 'Open'    (L839, T350, R854, B372)
   |    |    | ['Open', 'OpenButton', 'Button', 'Button0', 'Button1']
   |    |    | child_window(title="Open", auto_id="DropDown", control_type="Button")

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jduncan8142commented, Dec 20, 2018

Tried the uia backend but now I’m getting the below error:

Traceback (most recent call last):
  File "C:\Users\JN26633\Downloads\lp_test1.py", line 67, in <module>
    cf1.select("DeliveryNumber")
  File "C:\Python27\lib\site-packages\pywinauto\controls\uia_controls.py", line 158, in select
    self.expand()
  File "C:\Python27\lib\site-packages\pywinauto\controls\uiawrapper.py", line 527, in expand
    self.iface_expand_collapse.Expand()
  File "C:\Python27\lib\site-packages\pywinauto\controls\uiawrapper.py", line 132, in __get__
    value = self.fget(obj)
  File "C:\Python27\lib\site-packages\pywinauto\controls\uiawrapper.py", line 210, in iface_expand_collapse
    return uia_defs.get_elem_interface(elem, "ExpandCollapse")
  File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 234, in get_elem_interface
    raise NoPatternInterfaceError()
NoPatternInterfaceError

There is for sure a DeliveryNumber entry in the combobox but still the only control that works is texts()

cf1.children() gives:

[<uiawrapper.UIAWrapper - ‘Open’, SplitButton, 3527539>, <uia_controls.ListViewWrapper - ‘’, ListBox, 3527539>]

Tried the ListView controls and was unable to get much from it and couldn’t get anything from the SplitButton.

1reaction
airelilcommented, Dec 15, 2018

From a quick glance, it seems that you use the default win32 backend. Did you consider trying ‘uia’ ?

app = Application(backend='uia').connect(path=lp_file_path)
Read more comments on GitHub >

github_iconTop Results From Across the Web

UI Automation Support for the ComboBox Control Type
In UI Automation, a control type is a set of conditions that a control must meet in order to use the ControlTypeProperty property....
Read more >
Windows Ui Automation Select Item Of Combobox - ADocLib
I'm trying to select an item based on its value with the Windows UI Automation API.I have a class ComboBox which inherits from...
Read more >
selecting combobox item using ui automation - Stack Overflow
The big issue with the WPF ComboBox is that as far as Automation goes, it doesn't appear to have any ListItems until the...
Read more >
pywinauto Documentation - Read the Docs
pywinauto is a set of python modules to automate the Microsoft Windows GUI. At its simplest it allows you to send.
Read more >
Windows Automation API 3.0 Overview - CODE Magazine
On the Windows® operating system, Microsoft® Active Accessibility® and User Interface (UI) Automation support this programmatic access.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found