Micro Focus QTP (UFT) Forums
How to get the web page name dynamically - 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: How to get the web page name dynamically (/Thread-How-to-get-the-web-page-name-dynamically)



How to get the web page name dynamically - TPavani - 01-06-2012

Hi, I'm new to QTP.
I'm trying to automate an application using QTP, in which based on the input the web page name will be changed.
for example: if i give input as 1, the page name will be 'Pavani-1'
and if i give 2, the page may be 'Anu-2'.
If this is the behaviour of the web page, how to get the page name dynamically?


RE: How to get the web page name dynamically - sshukla12 - 01-06-2012

Hi,

There must be some logic from where it is picking these names like Pavani,Anu etc. Catch that logic and based on the input u made like 1 or 2 concatenate that with those name and u r done with dynamic names.

Regards,
Sankalp


RE: How to get the web page name dynamically - vinod123 - 01-06-2012

use GetROProperty to get the name of the page and store the name in to a variable use the variable in the script where ever you want to get the name of the webpage dynamically


RE: How to get the web page name dynamically - akankhyap@yahoo.co.in - 01-07-2012

Hi,

You can get it by using GetROproperty and as far as object identification is concerned, you can use regular expressions ex: for the webpage's title you can use ".*" in descriptive programming.
Code:
Browser("name:=").Webpage("title:=.*")

Thanks
Akankhya


RE: How to get the web page name dynamically - ravi.gajul - 01-07-2012

Assuming that there are few inputs and for the logic mentioned ...you may refer the below code
Code:
Option Explicit
strInput=inputbox( "Ener a value")
Select Case strInput
Case 1:
   Set oPage=Description.Create
    oPage("title").value="Pavani-1"
Case 2:
     Set oPage=Description.Create
    oPage("title").value="Anu-2"
Case Else
    Set oPage=Description.Create
    oPage("title").value="something"
End Select
'perform required operations on the page
'at the end
Set oPage=Nothing

you can go for what Akankhya said...but it would cause an issue if the page displayed is not as expected for a particular input.
Say for input 1, we expect "Pavani-1" page....but the page actually displayed could be an error page in which case we get error page title when we use Browser("name:=").Webpage("title:=.*").getROProperty("title").




RE: How to get the web page name dynamically - pavanit - 01-10-2012

hi,
i have tried with Webpage(:.*), but i didn't get....can u pls tell any other method