Micro Focus QTP (UFT) Forums
capturing the name of a variable browser page - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: capturing the name of a variable browser page (/Thread-capturing-the-name-of-a-variable-browser-page)



capturing the name of a variable browser page - jovowles - 10-13-2010

I'm testing a website that has a Logout link that is visible from every page (nearly 700). I want to write a function that can be called from any page, which will click the Logout link.
The problem I'm having is that I need to be able to supply the function with the name of the current page (which could be different every time) - any ideas how I can capture the current page?


RE: capturing the name of a variable browser page - supputuri - 10-13-2010

You can use the descriptive program to handle this situation.

Ex: Browswer(FunctionParameter).Page(FunctionParameter).Link("name:=Logout").Click

Let me know if you need any more information.


RE: capturing the name of a variable browser page - rajeshwar - 10-14-2010

Regular expression can be used:

Browswer("name:=.*").Page(title:=.*).Link("name:=Logout").Click

Rajeshwar


RE: capturing the name of a variable browser page - lavie - 10-19-2010

you can identify you generic browser(say myb) object and page(say myp) with
Code:
Dim myb, myp
set myb = description.create()
myb("title").value = ".*"  [i]'this must identify your browser whenever it is open - even on different pages[/i]
'U can confirm if it is there with
If Browser(myb).Exist = True
print "Browser Exists"
Else
Print "Browser is Absent"
End if

'For the page
set myp = description.create()
myp("title").Value = ".*Google.*  [i]'if U're working with google(4 instance), every google page is covered here.[/i]

If page(myp).Exist = True
print "Page Exists"
Else
Print "Page is Absent"
End if

' Ur page code will be identified in every page.

Thanks

Vic