Micro Focus QTP (UFT) Forums
URL to capture - 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: URL to capture (/Thread-URL-to-capture)



URL to capture - stevol - 05-13-2008

hi,
I open a website, then the URL changes... i want to capture this new URL (in a variable, in a cell...) but i don't know how. It's possible?
[the aim of the test is to confront a long list of websites, so i must do a cycle... but before i must be able to capture these URLs...]

thx,
ste


RE: URL to capture - niranjan - 05-14-2008

Try using GetROProperty("url")


RE: URL to capture - stevol - 05-14-2008

mmhhh... i have other problems before the use of your tip. I took a piece of code from another post, and i would want to apply your tip in it:

Code:
dim a
a="https://www.google.it"

SET IEObj = CreateObject("InternetExplorer.Application")
IEObj.Navigate a
IEObj.Visible = True
wait(2)  'suppose that in this time the url changes
Dim x
x=???
SET IEObj = Nothing


Which is the exact syntax to use GetROProperty("url") here to valorize x with the changed url?
I obtain syntax error about object repository...
[my problem is not to know the theory about these properties and their use... if you have some link to suggest me... :-) ]

thx for the patience :-)
ste


RE: URL to capture - sidartha - 05-14-2008

Hi,
i'm a beginner in QTP and VBScript.
i would like to get the url af the current page.


I tryed to print the url on a message box like following:
Code:
MsgBox Browser("Browser").GetROProperty("url")

In return, i have a emplty messagebox. That means the url was not captured.

I tried also MsgBox Browser("Browser").GetROProperty("openURL"). But this line gives the first opened URL.

do anyone can advice on this subject?

Thank you in advance.


RE: URL to capture - somisays - 05-14-2008

Dear sidartha,stevol
Can you post your QTP script what you are doing so that i cna help you in that.

Regards
Sridhar


RE: URL to capture - sidartha - 05-14-2008

Dear Sridhar,

My needs are following:
According to the URL, the password will change.
I have one identification scenario and some other scenarios where i need to confirm the password.

So i thought, in each scenario i need to confirm the password, i will capture the URL of the current page, do a IF statement and assign the value to the corresponding element.

Here is what i have tested:

Code:
Dim Env
Env = InputBox("Make your choice (INT, REC, PREX)")
If Env ="INT" Then
    Environment ("URL_ENV") = "http://www.google.com"
ElseIF  Env ="REC" Then
    Environment ("URL_ENV") = "http://www.yahoo.com"
ElseIF  Env ="PREX" Then
    Environment ("URL_ENV") = "http://www.msn.com"
Else
    Environment ("URL_ENV") = "http://www.homepage.com"
End If
Browser("Browser").Navigate (Environment ("URL_ENV"))
MsgBox Browser("Browser").GetROProperty("URL")


Do you have any other suggession?

Thank you for your help.