Results 1 to 3 of 3

Thread: Get active browser or web page

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    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


  2. #2
    Expert Member
    Join Date
    Jan 2007
    Answers
    211

    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


  3. #3

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact