无法从Lync中的第一个RICHEDIT60W子项获得标题

时间:2017-02-02 07:32:53

标签: pywinauto

此代码我没有获得第一个可用的RICHEDIT60W:

from pywinauto.application import Application
app = Application().connect(class_name='CommunicatorMainWindowClass')
window = app.window(class_name='CommunicatorMainWindowClass')

window.NetUINativeHWNDHost.NetUIHWND.print_control_identifiers()

print()
rich_edit = window.NetUINativeHWNDHost.NetUIHWND.NetUICtrlNotifySink.RICHEDIT60W
print("rich_edit:", rich_edit.WindowText())

控制台:

Control Identifiers:

NetUIHWND - ''    (L162, T378, R562, B957)
['', '1', 'NetUIHWND', '0']
child_window(class_name="NetUIHWND")
   | 
   | NetUICtrlNotifySink - ''    (L186, T408, R537, B425)
   | ['2', 'NetUICtrlNotifySink1', 'NetUICtrlNotifySink', 'NetUICtrlNotifySink0']
   | child_window(class_name="NetUICtrlNotifySink")
   |    | 
   |    | RICHEDIT60W - '///'    (L186, T408, R537, B425)
   |    | ['RICHEDIT60W0', '///RICHEDIT60W', 'RICHEDIT60W1', '///', 'RICHEDIT60W']
   |    | child_window(title="///", class_name="RICHEDIT60W")
   | 
   | RICHEDIT60W - '///'    (L186, T408, R537, B425)
   | ['RICHEDIT60W0', '///RICHEDIT60W', 'RICHEDIT60W1', '///', 'RICHEDIT60W']
   | child_window(title="///", class_name="RICHEDIT60W")
   | 
   | NetUICtrlNotifySink - ''    (L184, T548, R515, B562)
   | ['3', 'NetUICtrlNotifySink2']
   | child_window(class_name="NetUICtrlNotifySink")
   |    | 
   |    | RICHEDIT60W - 'qwerty'    (L184, T548, R515, B562)
   |    | ['RICHEDIT60W2', 'qwerty', 'qwertyRICHEDIT60W']
   |    | child_window(title="qwerty", class_name="RICHEDIT60W")
   | 
   | RICHEDIT60W - 'qwerty'    (L184, T548, R515, B562)
   | ['RICHEDIT60W2', 'qwerty', 'qwertyRICHEDIT60W']
   | child_window(title="qwerty", class_name="RICHEDIT60W")
   | 
   | NetUICtrlNotifySink - ''    (L162, T378, R162, B378)
   | ['4', 'NetUICtrlNotifySink3']
   | child_window(class_name="NetUICtrlNotifySink")

rich_edit: qwerty

lync

按照列表的元素,第一个必须是" ///"而不是" qwerty"

有什么问题?

如何使用" ///"?

获取该项目

1 个答案:

答案 0 :(得分:0)

原来是这样做的:

run:
Please enter strings to prepend to 'dataInput.txt'; -1 to EXIT: 
David
Goliath
Please enter strings to prepend to 'dataInput.txt'; -1 to EXIT: 
Delilah
Samson
Please enter strings to prepend to 'dataInput.txt'; -1 to EXIT: 
-1
# of objects prepended: 2
Closing file...
BUILD SUCCESSFUL (total time: 18 seconds)