-
Junior Member
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,
-
Expert Member
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
-
Forum Rules