I've been having a problem lately, when I select specific tabs (sheets) in excel documents, I get the following error:
c:\python27\lib\site-packages\pywinauto\controls\uia_controls.pyc in select(self, item)
402 def select(self, item):
403 """Select a tab by index or by name"""
--> 404 self._select(item)
405 return self
406
c:\python27\lib\site-packages\pywinauto\controls\uiawrapper.pyc in _select(self, item)
604 if item_index < len(list_):
605 wrp = list_[item_index]
--> 606 wrp.iface_selection_item.Select()
607 else:
608 raise IndexError("item not found")
COMError: (-2147467263, 'Not implemented', (None, None, None, 0, None))
This is the code:
app = pywinauto.Application(backend="uia").connect(process=43800)
tab_list = app.top_window().descendants(control_type="Tab")
tab_menu = tab_list[1]
tab_menu.select(1)
The excel document has multiple sheets.
The tab window is "uia_controls.TabControlWrapper - 'Sheet1', TabControl, 3527539".
It seems that the methods: get_selected_tab() and tab_count() work. So the only problem is the "select()" method which should actually select the tab.
I've tested it on multiple excel files, and in different environments (python2.7, windows 10 and windows 2016, with and without admin privileges)
What can be the problem here? Is there a solution or a workaround to this issue?
Thanks.