Hello I'm using Internet Explorer headless mode to perform automated tasks on my script but I'm encountering an issue when sometimes by surfing on some pages there are authentication popups that show up to log into the page but not through a HTML popup but more of a windows popup.
I wanted to get control of the popup so when it pops up it will be visible on TOP. Right now it's very random it sometimes shows on top of all programs but sometimes it's far in the background and then the automation fails because the user didn't see the popup.
Hardcoding username and password is not an option.
Does anybody know how I can manipulate the popup (see capture in attachment) and eventually atleast put it on top of screen?
Thanks!
Solution:
Public Sub New()
' This call is required by the designer.
InitializeComponent()
Automation.AddAutomationEventHandler(WindowPattern.WindowOpenedEvent, AutomationElement.RootElement,
TreeScope.Subtree,
Sub(UIElm, evt)
Dim element As AutomationElement = TryCast(UIElm, AutomationElement)
If element Is Nothing Then Return
Dim NativeHandle As IntPtr = CType(element.Current.NativeWindowHandle, IntPtr)
If InStr(element.Current.Name, "Windows Security") > 0 Then
AppActivate(element.Current.ProcessId)
End If
End Sub)
End Sub