pywinauto Listview GetItem(5,0)['text'] 是空
王漠言 2014-09-25 03:44:48 我用pywinauto去选择我要在控制面板中的应用程序,可以用Index可以选择,我想用Text去选择,我无法获得Text,请问大家什么问题?
#Start Control Panel
os.system('{0}\\System32\\control.exe appwiz.cpl'.format(os.environ['WINDIR'])) # open control panel
time.sleep(3)
#Focus the application
pwa_app = pywinauto.application.Application()
#try:
w_handle = pywinauto.findwindows.find_windows(title=u'Programs and Features', class_name='CabinetWClass')[0]
window = pwa_app.window_(handle=w_handle)
window.SetFocus()
ctrl = window['ListView']
ctrl_items = ctrl.Items()
ctrl_Texts = ctrl.Texts()
ctrl_GetItems = ctrl.GetItem(5,0)['text']
ctrl.Select(5)
print "Texts: ",ctrl_Texts[5]
print "GetItem: ",ctrl_GetItems