We are trying to automate a click of the following button in the Lync interface. The problem is that we cannot reliably click it. Sometimes it works; other times it doesn't. What we are trying to accomplish is to open the Lync options window.
Here are some parts of the problem:
System.Windows.Automation
namespace for UI automation.AutomationElement.FindFirst
to get UI elementTreeWalker
to walk all descendants of AutomomationElement.RootElement
TreeWalker
, we sometimes find a match, but oddly and unpredictably we sometimes don'tHow can we reliably find and click the button?
From Inspect.exe
How found: Selected from tree...
Name: ""
ControlType: UIA_MenuItemControlTypeId (0xC35B)
LocalizedControlType: "menu item"
ProcessId: 0
IsControlElement: true
IsContentElement: true
ProviderDescription: "[pid:3084,hwnd:0x0 Annotation:Microsoft: Annotation Proxy (unmanaged:UIAutomationCore.dll); Main(parent link):Microsoft: MSAA Proxy (unmanaged:UIAutomationCore.dll)]"
IsPeripheral: [Not supported]
LiveSettingProperty: [Not supported]
FlowsFrom: [Not supported]
OptimizeForVisualContent: [Not supported]
Annotation.AnnotationAuthor: [Not supported]
Annotation.AnnotationTypeId: [Not supported]
Annotation.Author: [Not supported]
Annotation.DateTime: [Not supported]
Annotation.Target: [Not supported]
Drag.DropEffect: [Not supported]
Drag.DropEffects: [Not supported]
Drag.GrabbedItems: [Not supported]
Drag.IsGrabbed: [Not supported]
DropTarget.DropTargetEffect: [Not supported]
DropTarget.DropTargetEffects: [Not supported]
LegacyIAccessible.ChildId: 3
LegacyIAccessible.Name: ""
ObjectModel.UnderlyingObjectModel: [Error: calling getter for this property: hr=0x80070057 - The parameter is incorrect.]
SpreadsheetItem.AnnotationObjects: [Not supported]
SpreadsheetItem.AnnotationTypes: [Not supported]
SpreadsheetItem.Formula: [Not supported]
Style.ExtendedProperties: [Not supported]
Style.FillColor: [Not supported]
Style.FillPatternColor: [Not supported]
Style.FillPatternStyle: [Not supported]
Style.Shape: [Not supported]
Style.StyleId: [Not supported]
Style.StyleName: [Not supported]
Transform2.CanZoom: [Not supported]
Transform2.ZoomLevel: [Not supported]
Transform2.ZoomMinimum: [Not supported]
Transform2.ZoomMaximum: [Not supported]
IsAnnotationPatternAvailable: [Not supported]
IsDragPatternAvailable: [Not supported]
IsDockPatternAvailable: false
IsDropTargetPatternAvailable: [Not supported]
IsExpandCollapsePatternAvailable: false
IsGridItemPatternAvailable: false
IsGridPatternAvailable: false
IsInvokePatternAvailable: false
IsItemContainerPatternAvailable: false
IsLegacyIAccessiblePatternAvailable: true
IsMultipleViewPatternAvailable: false
IsObjectModelPatternAvailable: [Not supported]
IsRangeValuePatternAvailable: false
IsScrollItemPatternAvailable: false
IsScrollPatternAvailable: false
IsSelectionItemPatternAvailable: false
IsSelectionPatternAvailable: false
IsSpreadsheetItemPatternAvailable: [Not supported]
IsSpreadsheetPatternAvailable: [Not supported]
IsStylesPatternAvailable: [Not supported]
IsSynchronizedInputPatternAvailable: false
IsTableItemPatternAvailable: false
IsTablePatternAvailable: false
IsTextChildPatternAvailable: [Not supported]
IsTextEditPatternAvailable: [Not supported]
IsTextPatternAvailable: false
IsTextPattern2Available: [Not supported]
IsTogglePatternAvailable: false
IsTransformPatternAvailable: false
IsTransform2PatternAvailable: [Not supported]
IsValuePatternAvailable: false
IsVirtualizedItemPatternAvailable: false
IsWindowPatternAvailable: false
FirstChild: [null]
LastChild: [null]
Next: [null]
Previous: [null]
Other Props: Object has no additional properties
Children: [Error: calling getter for this property: hr=0x80004005 - Unspecified error]
Ancestors: "Context" menu
"Context" window
[ No Parent ]
How about opening the drop down menu via UIA and then using SendKeys to send Alt-D ("%d")?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With