Results 1 to 2 of 2

Thread: QTP code to get the currently active browser or web page url during a test run?

  1. #1

    QTP code to get the currently active browser or web page url during a test run?

    Hi All,

    My Problem is currently I am on page
    http://ABC/basepage.aspx
    my test script hit a button on this page and I am expecting to get page
    http://ABC/page1.aspx
    but because of defect in application it goes to http://ABC/pagewrong.aspx

    I need to know the QTP code to handle and recover from this situation and then run the rest of the script ?
    Hope this can be done if
    1.I get the current open browser or page URL
    2.I can type the correct(or recovery) url in the address bar.

    Please confirm, provide code or suggest work around with code!
    Thanks,


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

    Re: QTP code to get the currently active browser or web page url during a test run?

    1. Please put a Checkpoint on the Page that is stopping the Flow, you can use standard Checkpoint on the Page that's obstructing the flow.

    Browser(browse).Page(pg).Frame(fr).WebElement(elem).Check Checkpoint(elem).

    2. Fire the Navigate Function to the intended Page in case the CheckPoint passes.

    If Browser(browse).Page(pg).Frame(fr).WebElement(elem).Check Checkpoint(elem) then
    Browser(browse).Navigate(New URL)
    Else

    '''Continue the Old Logic
    End If


    Hope that helps.

    Regards,
    Nawab


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