pywinauto python モジュールを使用して teamcenter のタスクを自動化しようとしていますが、TreeViews を適切に操作できませんでした。GetItem()、SubElements()、Item() および _treeview_element の下で他の多くの関数を使用しようとすると、エラーが発生します。以下のエラーを調べてください。
私はpython 2.7を使用しており、pywin32モジュールもインストールしています
for i in range(tr.ItemCount()):
print tr.GetItem(i)
トレースバック (最新の呼び出しが最後):
File "<pyshell#61>", line 2, in <module>
print tr.GetItem(i) File "C:\Users\patibj\Desktop\pywinauto-
master\pywinauto\controls\common_controls.py", line 1010, in GetItem
if isinstance(path[0], int):
TypeError: 'int' object has no attribute '__getitem__'
これは、GetChild() を使用しようとしているときです。
a[0] is <pywinauto.controls.common_controls._treeview_element object at 0x02EC11B0> a[0].GetChild((1))
Traceback (most recent call last):
File "<pyshell#49>", line 1, in <module>
a[0].GetChild((1))
File "C:\Users\patibj\Desktop\pywinauto- master\pywinauto\controls\common_controls.py", line 840, in GetChild
return self.Children()[index]
File "C:\Users\patibj\Desktop\pywinauto-master\pywinauto\controls\common_controls.py", line 739, in Children
if self.Item().cChildren not in (0, 1):
File "C:\Users\patibj\Desktop\pywinauto-master\pywinauto\controls\common_controls.py", line 539, in Item
return self._readitem()[0]
File "C:\Users\patibj\Desktop\pywinauto-master\pywinauto\controls\common_controls.py", line 904, in _readitem
raise ctypes.WinError() WindowsError: [Error 0] The operation completed successfully.
助けてください。よろしくお願いします。