Open vasily-v-ryabov opened 9 years ago
Problem ctrl.Button("New").Click()
also actual for ListView
and TabControl
.
Works fine for ComboBox
and Menu
.
The same bug for ComboBox item. See CmnCtrl3.exe
combo box for reference.
I've tried the latest build (x64, release): https://ci.appveyor.com/project/moden-py/swapy/build/1.0.30
Result:
import pywinauto
pwa_app = pywinauto.application.Application()
ctrl.Select('Black')
I expanded combo box items and chose "Select" for "Black" item.
There is a bug in the code generation for VirtualSWAPYObject
. The objects has no own init code
they are accessed through the parent.
For instance, combobox1.Select('Gray')
. No any combobox_item1
var.
Added checking for an empty init code
.
Fixed version - https://ci.appveyor.com/project/moden-py/swapy/build/1.0.32
resolved in a8b85dd0cf4eb6e18d4824eb6fd0dc6b302b0637
Using ctrl.Button("New").Click() is also better than magic index. If the "text" is not unique wrong item may be used. Use index access in such cases.
The fix depends on #66
It's reproduced on
.\apps\MFC_samples\CmnCtrl1.exe
. Just open "CToolBarCtrl" tab and run SWAPY.Find "New" toolbar button and select
Click
method. The following code is generated:ctrl
is not assigned here. Usingctrl.Button("New").Click()
is also better than magic index.Text
property is absent at the toolbar button description pane.