microsoft / WinAppDriver

Windows Application Driver
MIT License
3.67k stars 1.4k forks source link

Unable to get text from disabled ComboBox #1332

Open sszemer opened 3 years ago

sszemer commented 3 years ago

Hi, I'm trying to get text from a disabled ComboBox but with no success so far. every other disabled element is fine, just the ComboBox. UISpy shows: image How element looks like: image

what debugger shows for this element: image so my method to get text does not work correctly as it returns 'System.Xml.XmlElement' instead of 'TELEFONICA' public string GetGlobalName() { var pane = driver.FindElementByAccessibilityId("AddEditGridScrollViewer"); var cbox = pane.FindElement(By.ClassName("ComboBox")); return cbox.Text; } Am i doing something wrong? Anyone has an idea how to get the text? I would appreciate some help :) cheers

Shakevg commented 3 years ago

@sszemer can you can try the next:

  1. get next attribute: cbox.GetAttribute("Value.Value")
  2. check combo-box attributed page source XML: driver.PageSource
  3. post screenshot from Inspect.exe https://medium.com/@licanhua/inspecting-ui-elements-for-winappdriver-automation-using-appium-desktop-8f178b2d0d6c
sszemer commented 3 years ago

@sszemer can you can try the next:

  1. get next attribute: cbox.GetAttribute("Value.Value")
  2. check combo-box attributed page source XML: driver.PageSource
  3. post screenshot from Inspect.exe https://medium.com/@licanhua/inspecting-ui-elements-for-winappdriver-automation-using-appium-desktop-8f178b2d0d6c

hi, @Shakevg, got page source and i do not see the value anywhere there :/ Value.Value returns null data from inspect.exe

How found: Selected from tree... Name: "" ControlType: UIA_ComboBoxControlTypeId (0xC353) LocalizedControlType: "combo box" BoundingRectangle: {l:650 t:207 r:908 b:230} IsEnabled: false IsOffscreen: false IsKeyboardFocusable: false HasKeyboardFocus: false AcceleratorKey: "" AccessKey: "" ProcessId: 13000 RuntimeId: [7.32C8.1AD1E5A] AutomationId: "" FrameworkId: "WPF" ClassName: "ComboBox" IsControlElement: true IsContentElement: true ProviderDescription: "[pid:13000,providerId:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]" IsPassword: false ItemStatus: "" ItemType: "" IsRequiredForForm: false HelpText: "" ClickablePoint: {x:779 y:218} Orientation: 0 ExpandCollapse.ExpandCollapseState: Collapsed (0) LegacyIAccessible.ChildId: 0 LegacyIAccessible.DefaultAction: "Expand" LegacyIAccessible.Description: "" LegacyIAccessible.Help: "" LegacyIAccessible.KeyboardShortcut: "" LegacyIAccessible.Name: "" LegacyIAccessible.Role: combo box (0x2E) LegacyIAccessible.State: unavailable,collapsed (0x401) LegacyIAccessible.Value: "" Selection.CanSelectMultiple: false Selection.IsSelectionRequired: false Selection.Selection: "System.Xml.XmlElement" list item IsAnnotationPatternAvailable: false IsDragPatternAvailable: false IsDockPatternAvailable: false IsDropTargetPatternAvailable: false IsExpandCollapsePatternAvailable: true IsGridItemPatternAvailable: false IsGridPatternAvailable: false IsInvokePatternAvailable: false IsItemContainerPatternAvailable: true IsLegacyIAccessiblePatternAvailable: true IsMultipleViewPatternAvailable: false IsObjectModelPatternAvailable: false IsRangeValuePatternAvailable: false IsScrollItemPatternAvailable: false IsScrollPatternAvailable: false IsSelectionItemPatternAvailable: false IsSelectionPatternAvailable: true 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: "Address:" text Previous: "Global Name:" text Other Props: Object has no additional properties Children: Container has no children Ancestors: "" pane "System.Windows.Controls.TabItem Header: Content:" tab item "" tab "FSM563EMSIT" window "Desktop 1" pane [ No Parent ]

Gilesey commented 8 months ago

Is this because IsValuePatternAvailable: false? I've noticed that although Accessibility Insights and Inspect.exe show a Value.Value or ValuePattern.Value, we are unable to read it through WinAppDriver if the Pattern isn't officially available, even though, the value is a property that's popualted.