Micro Focus QTP (UFT) Forums
how to check if correct page/Browser is opened - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: how to check if correct page/Browser is opened (/Thread-how-to-check-if-correct-page-Browser-is-opened)



how to check if correct page/Browser is opened - uma87 - 08-03-2011

How can I check if the correct web page or browser is opened , when i click a link or a web button. Is there any procedure for this?

I'm trying this way
Code:
Link1Name = "Link1"
Link1Url = "http://www.link.com/Link1"

If browser().page().Link("Name:="&Link1Name&",url:="&Link1Url).Exist Then
Report Pass
Else
Report Fail

but , I doubt the performance of the script especially when there are too many links to be checked. I feel error check at very single link would take lots of time to run the script.


RE: how to check if correct page/Browser is opened - uma87 - 08-03-2011

I tried it using "Insert textCheckpoints" and captured the text that should appear on the expected link into datatable. so when I view results I can see if the captured text relates to the link or not.
I'm new to web testing, i donno if this is a feasible solution. correct me if this is wrong.


RE: how to check if correct page/Browser is opened - sshukla12 - 08-04-2011

U can use this:
Code:
If  Browser(oBrowser).Page(oPage).WebElement("html tag:=DIV","innertext:=SelectFlight").Exist Then
          Call WriteCheckpointResult(2,"Verification Of Page","page exists","Pass")
      Else
         Call WriteCheckpointResult(2,"Verification Of Page","page does not exists","Fail")
     End If