Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get the web page name dynamically
#1
Not Solved
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?
Reply
#2
Not Solved
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
Reply
#3
Not Solved
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
Reply
#4
Not Solved
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
Reply
#5
Not Solved
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").

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT issues with Outsystems dynamically generated Id/names jherron 2 1,346 03-02-2020, 09:33 PM
Last Post: Swishy70
  Unable to capture value of Webelement which is changing dynamically sheetal 9 16,212 02-16-2018, 11:01 AM
Last Post: janki_kakadia
  Unable to click on dynamically changing webelement preeti 0 1,807 04-29-2017, 08:50 PM
Last Post: preeti
  click each web link in a page using Index or other method in QTP smeijer 13 24,679 04-29-2017, 04:53 PM
Last Post: kowshik
  VB Script to count number of links in a web page. Suma Parimal 4 25,257 07-01-2015, 12:59 PM
Last Post: govind

Forum Jump:


Users browsing this thread: 1 Guest(s)