Micro Focus QTP (UFT) Forums
QTP and secondary web pages - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: QTP and secondary web pages (/Thread-QTP-and-secondary-web-pages)



QTP and secondary web pages - gabif - 01-13-2009

Hi,

Do you have any idea how I can skip from a web page to a new web page using QTP?
For example, I have next test:
- open an web page
- click on “test_1” link – when I click on this link a new page is open
How I can test the new open page using QTP?

Thanks


RE: QTP and secondary web pages - Ankur - 01-14-2009

How is it behaving now, when you attempt to record it.
Was creation time property of any help?


RE: QTP and secondary web pages - gabif - 01-14-2009

Sorry, I wasn't very clear.

The second page can be accessed if I make a record and after that I run the test. My problem is how to skip from a page to another page using descriptive programming. I do not use OBJECT REPOSITORY and the name of the web page is automatically retrieved.

Something like this:

Code:
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate  "http://xxxxxxxx.xx/"
IE.Visible = True
IE.Width = 850
IE.Height = 720

Function  GetPageName(IE)
  Do
     wait(0.1)
     Loop while IE.Busy = TRUE
     GetPageName=IE.document.title
End Function

pageName = GetPageName(IE)

Set obj_DescAssert = Description.Create
BrowserName="name:="+pageName
TitlePageName="title:="+pageName
Browser(BrowserName).Page(TitlePageName).WebButton("Help").Click
#the Help button open a new page

Here is the problem. I do not know how to get the name of the second page using descriptive programming (SecondBrowserName=?, SecondTitlePageName=?)

Browser(SecondBrowserName).Page(SecondTitlePageName).Link("Adding a New Group").Click


Thanks



RE: QTP and secondary web pages - gabif - 01-29-2009

I found how to resolve this issue
First we must get all IE open pages using next script:
Code:
function getSecondIEPage(FirstPageName)
      set x=Description.Create
      x("micclass").value="Browser"
      Set obj=Desktop.ChildObject(x)
      NoPages = obj.count
      For i=o to NoPages-1
           y=obj(i).getroproperty("name")
           If  FirstPageName = y Then
                    msgbox("This is the name of the first IE page that I opened")
           else
                    getSecondIEPage = c
           end If
       Next
End Function


The function return the name of the second IE page. The script work only if you have 2 IE pages opened.