Micro Focus QTP (UFT) Forums
Open a URL. through QTP - 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: Open a URL. through QTP (/Thread-Open-a-URL-through-QTP)

Pages: 1 2


Open a URL. through QTP - navyasatish - 05-13-2008

Hello All,

i am newbie to qtp ...

Can anyone give me a clue how to proceed on the below requirement...

when i try to run QTP...
it should prompt me a textbox(eg:- enter the URL you would like to open).
based on the text(eg:- URL name) which we enter into a text box... that particular website should open...


Thanks in advance
Navya


RE: Open a URL. through QTP - somisays - 05-13-2008

Hi Navya,
This is the code you asked for

systemutil.Run inputbox("")

But usually we donot use like this in real environement..

This is the following code in the real environement

systemutil.Run "www.mail.yahoo.com","","",3

now what you have to do is highlight systemutil and press f1 then learn about that object.

Hope that is going to help you...

Regards
Sridhar


RE: Open a URL. through QTP - navyasatish - 05-13-2008

Hello Sridhar,

thank you very much for the response.
i tried the option of systemutil.Run inputbox("")
it worked out for me...

but as you said it will not be used in realtime...
and also you have suggested to use the below one...
Code:
systemutil.Run "www.mail.yahoo.com","","",3

i have question on the above statement...

if i have 3 sets of urls like www.google.com or www.yahoo.com or www.monster.com...

and every time i ran the script i may be using any one among the 3 above urls then in that case is there any way to read the url and pass that url into a variable and then pass this variable as a parameter to the systemutil.run statement ???

like i followed the below steps...

Code:
sName = InputBox("Enter Url")
systemutil.Run " &sName "","","",3


i am getting Run Error saying : "invalid procedure call or argument"

i might be doing wrong.... please correct me...


Thanks
Navya


RE: Open a URL. through QTP - newqtp - 05-14-2008

please check your syntax you have used more than one " in systemutil.run line..Hope this was the only problem..:-)


RE: Open a URL. through QTP - navyasatish - 05-14-2008

this time i tried using the below format ....

Code:
sName = InputBox("Enter Url")
systemutil.Run  ""& sName,"","",open,3

it worked out successfully for me.

Thanks for all suggestions...

thanks
Navya


RE: Open a URL. through QTP - niranjan - 05-14-2008

Or you can use a Procedure:
Example:

Code:
StrURL = InputBox("Enter the URL")
Call InvokeIE(StrURL)

Function InvokeIE(URL)
       SET IEObj = CreateObject("InternetExplorer.Application")
       IEObj.Navigate URL
       IEObj.Visible = True
       SET IEObj = Nothing
End Function



RE: Open a URL. through QTP - navyasatish - 05-14-2008

Hi niranjan
Thanks for the another solution...


RE: Open a URL. through QTP - Akhila - 05-20-2008

Hi,
In the above script I have given the URL as www.gmail.com, for closing the browser I used
Browser("Browser").close after call Invoke function
but it saying object not found
Which command I need to use to close it?

Thanks,
Akhila


RE: Open a URL. through QTP - niranjan - 05-21-2008

Instead of Browser("Browser").Close, try using Browser("name:=.*").Close


RE: Open a URL. through QTP - Akhila - 05-22-2008

Sorry I have some silly doubts about it
1) In the above script what does "name" refers to ? Is it the name of the browser... like Gmail
2) Just for closing the browser why I need to use "name:=.*"? Can you suggest some material to learn such functionalities
3) When I modified the script as you suggested I got the following error "Cannot identify the object "[ Browser ]" (of class Browser). Verify that this object's properties match an object currently displayed in your application."

Thanks,