Micro Focus QTP (UFT) Forums
What is the best way to launch the browser - 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: What is the best way to launch the browser (/Thread-What-is-the-best-way-to-launch-the-browser)



What is the best way to launch the browser - soumya - 12-04-2011

Good afternoon everybody,

I have come across a post in this forum where someone has used the following code to launch the browser


Code:
function open()
   Dim oexplorer
   Set oexplorer=createobject("InternetExplorer.application")
   oexplorer.visible=true
   oexplorer.navigate "http:\\yahoo.in"
   Set open=oexplorer
   Set oexplorer=nothing
   End Function

   Call open()

It is an interesting way, no doubt. But which is the best way to launch the browser and why. Calling a function like this or a simple systemutil.run?


Thank you so much

Soumya


RE: What is the best way to launch the browser - nistalaramesh - 12-05-2011

There are many ways to launch Browser, I decide my comfortable level and used below code.

Code:
SystemUtil.Run "iexplore.exe"
Browser("title:=.*").page("title:=.*").Sync
Browser("title:=.*").Navigate "www.google.co.in"



RE: What is the best way to launch the browser - soumya - 12-06-2011

Hi Ramesh,
I also used to follow the same conventional method. but i was told that it is not an optimal solution. Calling a function is one of the methods, but i do not know the advantages of one method over the other.


RE: What is the best way to launch the browser - sshukla12 - 12-06-2011

Code:
function open(strURL)
Dim oexplorer
Set oexplorer=createobject("InternetExplorer.application")
oexplorer.visible=true
oexplorer.navigate strURL
Set open=oexplorer
Set oexplorer=nothing
End Function


Call open("http:\\yahoo.in")

I think this approach will make the function dynamic.

Regards,
Sankalp


RE: What is the best way to launch the browser - v.swaminathan - 12-12-2011

The LOC that I prefer is as below. Some benefits here are,
* with this we can open any browser,
* open the browser in maximized state, and also,
* in the first step itself we navigate to the test application directly at launch. This way we also optimize the Automation test execution by minimizing a test step to navigate to the required test application.

<Code Starts Here>

Code:
SystemUtil.Run Environment("BrowserName"),Environment("TD_URL"),Environment("BrowserLocation"),"", 3

<Code Ends Here>


Note:
There are 3 environment variables used by me in the above code.