While using pywinauto for automated testing, I encountered a situation where I needed to retrieve the title (name) of a child control for evaluation. I can see the element's information in inspect.exe, but it's not present in pywinauto's control tree. I noticed that the element's attributes are IsControlElement=false and IsContentElement=false. How can I retrieve the text value of this child control?The information for these two elements is as follows:
How found: Selected from tree...
Name: "Excavation steps"
ControlType: UIA_TextControlTypeId (0xC364)
LocalizedControlType: "文本"
BoundingRectangle: {l:730 t:179 r:778 b:194}
IsEnabled: true
IsOffscreen: false
IsKeyboardFocusable: false
HasKeyboardFocus: false
AcceleratorKey: ""
AccessKey: ""
ProcessId: 14208
RuntimeId: [7.3780.2FD41A2]
AutomationId: "txtAddRow"
FrameworkId: "WPF"
ClassName: "TextBlock"
IsControlElement: false
IsContentElement: false
ProviderDescription: "[pid:14208,providerId:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]"
LiveSettingProperty: Off (0)
IsPassword: false
ItemStatus: ""
ItemType: ""
IsRequiredForForm: false
HelpText: ""
ClickablePoint: {x:754 y:186}
Orientation: 0
PositionInSet: 4294967295
SizeOfSet: 4294967295
IsDialog: false
HeadingLevel: HeadingLevel_None (0x138B2)
LegacyIAccessible.ChildId: 0
LegacyIAccessible.DefaultAction: ""
LegacyIAccessible.Description: ""
LegacyIAccessible.Help: ""
LegacyIAccessible.KeyboardShortcut: ""
LegacyIAccessible.Name: "Excavation steps"
LegacyIAccessible.Role: 文字 (0x29)
LegacyIAccessible.State: 正常 (0x0)
LegacyIAccessible.Value: ""
IsAnnotationPatternAvailable: false
IsDragPatternAvailable: false
IsDockPatternAvailable: false
IsDropTargetPatternAvailable: false
IsExpandCollapsePatternAvailable: false
IsGridItemPatternAvailable: false
IsGridPatternAvailable: false
IsInvokePatternAvailable: false
IsItemContainerPatternAvailable: false
IsLegacyIAccessiblePatternAvailable: true
IsMultipleViewPatternAvailable: false
IsObjectModelPatternAvailable: false
IsRangeValuePatternAvailable: false
IsScrollItemPatternAvailable: false
IsScrollPatternAvailable: false
IsSelectionItemPatternAvailable: false
IsSelectionPatternAvailable: false
IsSpreadsheetItemPatternAvailable: false
IsSpreadsheetPatternAvailable: false
IsStylesPatternAvailable: false
IsSynchronizedInputPatternAvailable: true
IsTableItemPatternAvailable: false
IsTablePatternAvailable: false
IsTextChildPatternAvailable: false
IsTextEditPatternAvailable: false
IsTextPatternAvailable: false
IsTextPattern2Available: false
IsTogglePatternAvailable: false
IsTransformPatternAvailable: false
IsTransform2PatternAvailable: false
IsValuePatternAvailable: false
IsVirtualizedItemPatternAvailable: false
IsWindowPatternAvailable: false
IsCustomNavigationPatternAvailable: false
IsSelectionPattern2Available: false
FirstChild: [null]
LastChild: [null]
Next: [null]
Previous: "" 图像
Other Props: Object has no additional properties
Children: Container has no children
Ancestors: "" 编辑
"" 自定义
"app v2.0.15.10-a" 窗口
"桌面 1" 窗格
[ No Parent ]
How found: Selected from tree...
Name: ""
ControlType: UIA_EditControlTypeId (0xC354)
LocalizedControlType: "编辑"
BoundingRectangle: {l:730 t:159 r:778 b:194}
IsEnabled: true
IsOffscreen: false
IsKeyboardFocusable: true
HasKeyboardFocus: false
AcceleratorKey: ""
AccessKey: ""
ProcessId: 14208
RuntimeId: [7.3780.2425624]
AutomationId: ""
FrameworkId: "WPF"
ClassName: "TextBox"
IsControlElement: true
IsContentElement: true
ProviderDescription: "[pid:14208,providerId:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]"
LiveSettingProperty: Off (0)
IsPassword: false
ItemStatus: ""
ItemType: ""
IsRequiredForForm: false
HelpText: ""
ClickablePoint: {x:754 y:176}
Orientation: 0
PositionInSet: 4294967295
SizeOfSet: 4294967295
IsDialog: false
HeadingLevel: HeadingLevel_None (0x138B2)
LegacyIAccessible.ChildId: 0
LegacyIAccessible.DefaultAction: ""
LegacyIAccessible.Description: ""
LegacyIAccessible.Help: ""
LegacyIAccessible.KeyboardShortcut: ""
LegacyIAccessible.Name: ""
LegacyIAccessible.Role: 可编辑文本 (0x2A)
LegacyIAccessible.State: 可设定焦点 (0x100000)
LegacyIAccessible.Value: ""
Value.IsReadOnly: false
Value.Value: ""
IsAnnotationPatternAvailable: false
IsDragPatternAvailable: false
IsDockPatternAvailable: false
IsDropTargetPatternAvailable: false
IsExpandCollapsePatternAvailable: false
IsGridItemPatternAvailable: false
IsGridPatternAvailable: false
IsInvokePatternAvailable: false
IsItemContainerPatternAvailable: false
IsLegacyIAccessiblePatternAvailable: true
IsMultipleViewPatternAvailable: false
IsObjectModelPatternAvailable: false
IsRangeValuePatternAvailable: false
IsScrollItemPatternAvailable: false
IsScrollPatternAvailable: false
IsSelectionItemPatternAvailable: false
IsSelectionPatternAvailable: false
IsSpreadsheetItemPatternAvailable: false
IsSpreadsheetPatternAvailable: false
IsStylesPatternAvailable: false
IsSynchronizedInputPatternAvailable: true
IsTableItemPatternAvailable: false
IsTablePatternAvailable: false
IsTextChildPatternAvailable: false
IsTextEditPatternAvailable: false
IsTextPatternAvailable: true
IsTextPattern2Available: false
IsTogglePatternAvailable: false
IsTransformPatternAvailable: false
IsTransform2PatternAvailable: false
IsValuePatternAvailable: true
IsVirtualizedItemPatternAvailable: false
IsWindowPatternAvailable: false
IsCustomNavigationPatternAvailable: false
IsSelectionPattern2Available: false
FirstChild: "" 图像
LastChild: "Excavation steps" 文本
Next: [null]
Previous: [null]
Other Props: Object has no additional properties
Children: "" 图像
"Excavation steps" 文本
Ancestors: "" 自定义
"app v2.0.15.10-a" 窗口
"桌面 1" 窗格
[ No Parent ]