Search code examples
testingautomationqtphp-uft

What is the working of Browser and Page in QTP/UFT?


I always get a doubt that:

What exactly is the difference between the working of Browser and Page.

I know it is a hierarchy and that stuff, but how does the tool differentiates the browser and page and what is use of having both of them.

For example, if I use descriptive programming, and type:

Browser("title:=Google").Page("title:=Google").something

irrespective of the Browser (which may be IE / Chrome / Firefox) it will use the browser with the title = Google. And same is for the page.

Please elaborate. I am confused.


Solution

  • There's an explanation of what Browser and Page are supposed to represent on HP's blog.

    In short Page has no semantic meaning, it is just used in order to organize the object repository more cleanly (so that you don't get hundreds of objects under one Browser object). If you're using descriptive programming (as I see from your example) then the Page has no meaning (since every browser has only one Page) and having a description for the page adds nothing.

    I would replace the line with:

    Browser("title:=Google").Page("title:=.*").something
    

    Or

    Browser("title:=Google").Page("micclass:=Page").something