AE_ComboBox = uia.GetElementByControlTypeAndAutomationId(globalSettings, ControlType.ComboBox, "1");
AE_TargetValue = uia.GetElement(AE_ComboBox, value, true);
SelectionItemPattern SIP = AE_TargetValue.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern;
SIP.Select();
Thread.Sleep(2000);
SIP.Current.IsSelected
This code throws an exception at the last line.
The target element corresponds to UI that is no longer available (for example, the parent window has closed).
at MS.Internal.AutomationProxies.Misc.ThrowWin32ExceptionsIfError(Int32 errorCode)
at MS.Internal.AutomationProxies.Misc.ProxySendMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Internal.AutomationProxies.WindowsListBox.ListboxItem.System.Windows.Automation.Provider.ISelectionItemProvider.get_IsSelected()
So, what could be the issue here?
Also, another question is, what does "current" mean in SelectionItemPattern
? (I am sure it does not mean the current selected element.)