Search code examples
pythoncheckboxtogglepywinauto

pywinauto CheckBox toggle not working (no error)


I am trying to toggle a Checkbox in a TreeView but won't work. Elements is correct doesn't give me any error toggling other TreeItem works but trying to toggle the first TreeItem doesn't

 app = Application(backend='uia').start(WEB_INSTALLER_LOCATION, timeout=10)
 installer = Desktop(backend='uia').window(title_re=APP_INSTALLER_NAME)

 app = Application(backend='uia').connect(title=APP_INSTALLER_NAME)

 test = app.Dialog.TreeView.TreeItem.Checkbox
 test.toggle()

I can check its toggle state, I can even draw_outline, but toggle() returns me nothing.


Solution

  • Some check boxes have no implementation of toggle handler. So you have to use .invoke() or .click_input() in the worst case. It doesn't depend on backend. It's an app side issue.