Good day everyone, have some trouble with UI automation while trying to click a button on Outlook security warning while trying to send mails through My client, when I try to send it it shows the alert prompt to choose if I want to allow e-mail send or not.
This is my code so far it recognizes everything but when it comes to the point of invoking the pattern on the allow button it does nothing, already checked the ispassword property to check if this button is locked but no luck so far.
aeDesktop = AutomationElement.RootElement
Dim ipClickOkBtn As InvokePattern
Dim numwaits As Integer
Do
aeOut = aeDesktop.FindFirst(TreeScope.Subtree, New PropertyCondition(AutomationElement.NameProperty, "Microsoft Outlook"))
numwaits += 1
Thread.Sleep(100)
Loop While aeOut Is Nothing AndAlso numwaits < 50
If Not IsNothing(aeOut) Then
aePass = aeOut.FindFirst(TreeScope.Children, New PropertyCondition(AutomationElement.NameProperty, "Allow"))
Dim isTextPassword As Boolean = CBool(aePass.GetCurrentPropertyValue(AutomationElement.IsPasswordProperty))
End If
ipClickOkBtn = DirectCast(aePass.GetCurrentPattern(InvokePattern.Pattern), InvokePattern)
aePass.SetFocus()
SendKeys.SendWait(vbCr)
SendKeys.SendWait("{ENTER}")
ipClickOkBtn.Invoke()
Any ideas?, thanks a lot for your help.