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.

Getting/Setting ListItem in OBS

See original GitHub issue

I’m having the same problem as another issue #507 but this time it’s related with ListItem under Properties of a Window Capture.

The control looks like this (onyl relevant part):

   |    |    |    |    | ComboBox - ' Down'    (L813, T521, R1380, B541)
   |    |    |    |    | [' DownComboBox', ' Down', 'ComboBox', ' DownComboBox0', ' DownComboBox1', ' Down0', ' Down1', 'ComboBox0', 'ComboBox1']
   |    |    |    |    | child_window(title=" Down", control_type="ComboBox")
   |    |    |    |    |    | 
   |    |    |    |    |    | ListBox - ''    (L0, T0, R0, B0)
   |    |    |    |    |    | ['7', 'ListBox', 'ListBox0', 'ListBox1']
   |    |    |    |    |    |    | 
   |    |    |    |    |    |    | ListItem - '[LockApp.exe]: A Windows alapértelmezett zárolási képernyője'    (L0, T0, R640, B13)
   |    |    |    |    |    |    | ['[LockApp.exe]: A Windows alapértelmezett zárolási képernyője', 'ListItem', '[LockApp.exe]: A Windows alapértelmezett zárolási képernyőjeListItem', 'ListItem0', 'ListItem1']

The way I tried was APP.PropertiesForWindowCapture.DownComboBox.select("the item I want to select") which throws the same error as the referenced issue:

16:31:16.864 ERROR   STDERR            write               @ 22 Traceback (most recent call last):
16:31:16.864 ERROR   STDERR            write               @ 22   File "C:\Users\oliver.horvath\venv\pywinteszt\lib\site-packages\pywinauto\uia_defines.py", line 232, in get_elem_interface
16:31:16.865 ERROR   STDERR            write               @ 22 iface = cur_ptrn.QueryInterface(cls_name)
16:31:16.866 ERROR   STDERR            write               @ 22   File "C:\Users\oliver.horvath\venv\pywinteszt\lib\site-packages\comtypes\__init__.py", line 1158, in QueryInterface
16:31:16.868 ERROR   STDERR            write               @ 22 self.__com_QueryInterface(byref(iid), byref(p))
16:31:16.868 ERROR   STDERR            write               @ 22 ValueError
16:31:16.868 ERROR   STDERR            write               @ 22 :
16:31:16.869 ERROR   STDERR            write               @ 22 NULL COM pointer access
16:31:16.869 ERROR   STDERR            write               @ 22 
16:31:16.870 ERROR   STDERR            write               @ 22 During handling of the above exception, another exception occurred:
16:31:16.870 ERROR   STDERR            write               @ 22 Traceback (most recent call last):
16:31:16.870 ERROR   STDERR            write               @ 22   File "C:/Users/oliver.horvath/PycharmProjects/autoivs/main.py", line 146, in <module>
16:31:16.871 ERROR   STDERR            write               @ 22 main()
16:31:16.872 ERROR   STDERR            write               @ 22   File "C:/Users/oliver.horvath/PycharmProjects/autoivs/main.py", line 93, in main
16:31:16.873 ERROR   STDERR            write               @ 22 obs.Settings()
16:31:16.873 ERROR   STDERR            write               @ 22   File "C:\Users\oliver.horvath\PycharmProjects\autoivs\obs.py", line 84, in Settings
16:31:16.874 ERROR   STDERR            write               @ 22 elem.PropertiesForWindowCapture.DownComboBox.select("[rcclient.exe]")
16:31:16.874 ERROR   STDERR            write               @ 22   File "C:\Users\oliver.horvath\venv\pywinteszt\lib\site-packages\pywinauto\controls\uia_controls.py", line 158, in select
16:31:16.875 ERROR   STDERR            write               @ 22 self.expand()
16:31:16.875 ERROR   STDERR            write               @ 22   File "C:\Users\oliver.horvath\venv\pywinteszt\lib\site-packages\pywinauto\controls\uiawrapper.py", line 510, in expand
16:31:16.876 ERROR   STDERR            write               @ 22 self.iface_expand_collapse.Expand()
16:31:16.876 ERROR   STDERR            write               @ 22   File "C:\Users\oliver.horvath\venv\pywinteszt\lib\site-packages\pywinauto\controls\uiawrapper.py", line 131, in __get__
16:31:16.878 ERROR   STDERR            write               @ 22 value = self.fget(obj)
16:31:16.878 ERROR   STDERR            write               @ 22   File "C:\Users\oliver.horvath\venv\pywinteszt\lib\site-packages\pywinauto\controls\uiawrapper.py", line 209, in iface_expand_collapse
16:31:16.879 ERROR   STDERR            write               @ 22 return uia_defs.get_elem_interface(elem, "ExpandCollapse")
16:31:16.879 ERROR   STDERR            write               @ 22   File "C:\Users\oliver.horvath\venv\pywinteszt\lib\site-packages\pywinauto\uia_defines.py", line 234, in get_elem_interface
16:31:16.880 ERROR   STDERR            write               @ 22 raise NoPatternInterfaceError()
16:31:16.880 ERROR   STDERR            write               @ 22 pywinauto.uia_defines
16:31:16.880 ERROR   STDERR            write               @ 22 .
16:31:16.881 ERROR   STDERR            write               @ 22 NoPatternInterfaceError

I also tried pywinauto.controls.uia_controls.ComboBoxWrapper(elem.PropertiesForWindowCapture.DownComboBox).select("[RCClient.exe]: Intellio Client 4") without success, throwing:

09:30:46.676 ERROR   STDERR            write               @ 23 During handling of the above exception, another exception occurred:
09:30:46.676 ERROR   STDERR            write               @ 23 Traceback (most recent call last):
09:30:46.677 ERROR   STDERR            write               @ 23   File "C:/Users/oliver.horvath/PycharmProjects/autoivs/main.py", line 132, in <module>
09:30:46.678 ERROR   STDERR            write               @ 23 if premain() == "exit":
09:30:46.678 ERROR   STDERR            write               @ 23   File "C:/Users/oliver.horvath/PycharmProjects/autoivs/main.py", line 50, in premain
09:30:46.679 ERROR   STDERR            write               @ 23 obs.Settings()
09:30:46.679 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\PycharmProjects\autoivs\obs.py", line 79, in Settings
09:30:46.680 ERROR   STDERR            write               @ 23 pywinauto.controls.uia_controls.ComboBoxWrapper(elem.PropertiesForWindowCapture.DownComboBox).select("[RCClient.exe]: Intellio Client 4")
09:30:46.680 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\controls\uia_controls.py", line 158, in select
09:30:46.681 ERROR   STDERR            write               @ 23 self.expand()
09:30:46.681 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\controls\uiawrapper.py", line 510, in expand
09:30:46.683 ERROR   STDERR            write               @ 23 self.iface_expand_collapse.Expand()
09:30:46.683 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\controls\uiawrapper.py", line 131, in __get__
09:30:46.685 ERROR   STDERR            write               @ 23 value = self.fget(obj)
09:30:46.685 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\controls\uiawrapper.py", line 209, in iface_expand_collapse
09:30:46.687 ERROR   STDERR            write               @ 23 return uia_defs.get_elem_interface(elem, "ExpandCollapse")
09:30:46.687 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\uia_defines.py", line 231, in get_elem_interface
09:30:46.691 ERROR   STDERR            write               @ 23 cur_ptrn = element_info.GetCurrentPattern(ptrn_id)
09:30:46.692 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\application.py", line 351, in __getattribute__
09:30:46.693 ERROR   STDERR            write               @ 23 ctrls = self.__resolve_control(self.criteria)
09:30:46.693 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\application.py", line 248, in __resolve_control
09:30:46.694 ERROR   STDERR            write               @ 23 raise e.original_exception
09:30:46.694 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\timings.py", line 427, in wait_until_passes
09:30:46.695 ERROR   STDERR            write               @ 23 func_val = func(*args)
09:30:46.695 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\application.py", line 209, in __get_ctrl
09:30:46.695 ERROR   STDERR            write               @ 23 ctrl = self.backend.generic_wrapper_class(findwindows.find_element(**ctrl_criteria))
09:30:46.696 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\findwindows.py", line 84, in find_element
09:30:46.699 ERROR   STDERR            write               @ 23 elements = find_elements(**kwargs)
09:30:46.700 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\findwindows.py", line 300, in find_elements
09:30:46.701 ERROR   STDERR            write               @ 23 elements = findbestmatch.find_best_control_matches(best_match, wrapped_elems)
09:30:46.701 ERROR   STDERR            write               @ 23   File "C:\Users\oliver.horvath\venv\autoivspackages\lib\site-packages\pywinauto\findbestmatch.py", line 533, in find_best_control_matches
09:30:46.706 ERROR   STDERR            write               @ 23 raise MatchError(items = name_control_map.keys(), tofind = search_text)
09:30:46.707 ERROR   STDERR            write               @ 23 pywinauto.findbestmatch
09:30:46.707 ERROR   STDERR            write               @ 23 .
09:30:46.707 ERROR   STDERR            write               @ 23 MatchError
09:30:46.707 ERROR   STDERR            write               @ 23 :
09:30:46.707 ERROR   STDERR            write               @ 23 Could not find 'element' in 'dict_keys([])'

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
airelilcommented, Dec 26, 2018

Just FYI. I managed to create a sort of sample app with PyQT5 and qtdesigner.

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 300)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(30, 240, 341, 32))
        self.buttonBox.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.comboBox = QtWidgets.QComboBox(Dialog)
        self.comboBox.setGeometry(QtCore.QRect(20, 40, 101, 22))
        self.comboBox.setObjectName("comboBox")
        self.comboBox.addItem("")
        self.comboBox.setItemText(0, "")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.comboBox.addItem("")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 20, 101, 16))
        self.label.setObjectName("label")

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "pyQT5 ComboBox sample"))
        self.comboBox.setItemText(1, _translate("Dialog", "Red Star"))
        self.comboBox.setItemText(2, _translate("Dialog", "Blue Sky"))
        self.comboBox.setItemText(3, _translate("Dialog", "Green Grass"))
        self.label.setText(_translate("Dialog", "Select colour"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Dialog = QtWidgets.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec_())

The demo also doesn’t have ExpandCollapsePattern so now we can try to tune the UIA ComboBoxWrapper to handle it as well

0reactions
vasily-v-ryabovcommented, Feb 9, 2019

Well, this way doesn’t work. It’s something connected with keyboard focus.

I decided to always return “collapsed” state for Qt5 combo until we could find a solution. All other methods have been fixed in PR #669.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Game Capture Guide - OBS Studio
This guide is specifically for configuring the Game Capture Source properly, and goes over basic troubleshooting if things may not be working.
Read more >
Wiki - OBS Studio Quickstart
OBS Studio Quickstart · 1. Run the auto-configuration wizard · 2. Set up your audio devices · 3. Add your sources for video...
Read more >
Wiki - Getting Started With OBS Scripting
OBS can be extended with Python and Lua scripts. This set of pages explains the basics to get started and describes how to...
Read more >
Dropped Frames And General Connection Issues - OBS Studio
Dynamic Bitrate · Lower your bitrate · Change stream server · Test using a different service · Enable network optimizations · Bind to...
Read more >
General Performance And Encoding Issues - OBS Studio
Encoding video is a very CPU-intensive operation, and OBS is no exception. OBS uses the best open source video encoding library available, x264, ......
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