There is an application on which a link is present. Once clicked on the link, it opens up a new browser.
Can someone please help to guide how to select and activate the new window?
I am using UFT for Automation.
Using browser collection, we can achieve this. Hope this helps for.
Set objLastBrowser = GetLastBrowserInstance()
Public Function GetLastBrowserInstance()
Dim objBrowserDesc
Dim objBrowserCollection
Dim objLastOpenedBrowser : objLastOpenedBrowser = Null
Dim intCount
Dim lngHandle
Set objBrowserDesc = Description.Create
objBrowserDesc("micClass").Value = "Browser"
Set objBrowserCollection = Desktop.ChildObjects(objBrowserDesc)
intCount = objBrowserCollection.Count
If intCount > 0 Then
Set objLastOpenedBrowser = Browser("CreationTime:=" & intCount - 1)
objLastOpenedBrowser.Sync
lngHandle = objLastOpenedBrowser.GetROProperty("hwnd")
Window("hwnd:=" & lngHandle).Activate
End If
Set GetLastBrowserInstance = objLastOpenedBrowser
End Function
Browser("Browser1")and useBrowser("Browser2")? Can you give an example where this isn't working for you? - DaveCreationTime:=0they won't be able to properly switch the reference - Victor Moraes