'How to make qtbot select an item from QComboBox?
I'm trying to develop a simple test application (using pytest) that tests an interface with many PyQt5 components (QLabel, QLineEdit, QCheckBox, QRadioButton and QComboBox), but I'm struggling with the combobox one.
How can I click on a QComboBox item using qtbot.mouseClick?
Here's what my QComboBox section looks like.
self.comboBox = QtWidgets.QComboBox(Form)
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("ONE")
self.comboBox.addItem("TWO")
self.comboBox.addItem("THREE")
Solution 1:[1]
qtbot.keyClicks(self.comboBox, "ONE")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Y.Wang |