-
Junior Member
Get active browser or web page
What is QTP Code or syntax to get active browser or web page at any time during run of script?
Lets say I am running my QTP test script on page "http//ABC/xyz/somepage.aspx" at any point of time.
I can view this page manually open the opened browser screen...but how to get that captured using my QTP code
-
Expert Member
Re: Get active browser or web page
1.Set oD = Description.Create()
oD("micclass").value = "Browser"
Set oDObj = Desktop.childObjects(oD)
''''Perform Operation on the child Objects
''''They are the browser's on the desktop
2. Continued
Set oF = Description.Create
oF("micclass").value = "Frame"
Set oFObj = oDObj(1).ChildObjects(oF)
''''Perform Operations on the Frame in Collection "oFObj"
Regards,
Nawab
-
Moderator
Re: Get active browser or web page
One way this can be done is:
Public Sub BrowserExist()
For intNumberOfBrowsers = 0 to 99
If Browser("creationTime:="&intNumberOfBrowsers).Exist Then
strChk=True
Else
strChk=False
Exit For
End If
Next
If strChk = True Then
msgBox "" & intNumberOfBrowsers & " Browser(s) Currently Open"
Else
msgBox "No Browsers currently Open"
End If
End Sub
Usage: Call BrowserExist()
-------
Another way:
Public Function chkBrowserExist(creationT)
If Browser("creationTime:= "&creationT).Exist Then
strChk = True
Else
strChk = false
End If
chkBrowserExist = strChk
End Function
Usage: Call chkBrowserExist(0)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules