What is the command in QTP to invoke IE Browser?

To Invoke Browser in QTP there are three ways to invoke IE browser and launch a website from QTP. To be very specific to your question to invoke only IE browser in QTP you can do it but it will only open a blank IE browser. In order to do this you need to use the method called as "InvokeApplication"


Syntax

InvokeApplication "Path"

Example


Invokeapplication "C:Program Files\Internet Explorer\iexplore.exe"

Invokeapplication "C:Program Files\Mercury Interactive\QuickTest Professional\bin\QTPro.exe" 'This will invoke QTP.

There are other ways to Invoke browser in QTP and also a particular web site like google.com

1. We will use the "SystemUtil" object associated with a "Run" method

Syntax

SystemUtil.Run "url"

Example

SystemUtil.Run http://www.google.com

Here when you run this line of code systemutil.run executes a method called run by which the IE browser is opened and also the url mentioned is launched. This is useful when you want QTP to directly launch the website you want in a single step.

2. When you want to invoke IE and then launch a url through script you can use the object function library.

Set IE CreateObject("InternetExplorer.Application")
IE.Visible True
IE.Navigate http://www.google.com

2 comments:

Anonymous said...

Wen ever i use IE=createObject
(Ineternetexplorer.application)
QTP just navigates to the URL mentioned but doesn't
recognise the USErname and Password field so the test
fails..
But wen i just record and use system.util "iexplore"
the code recognises and the tst passes, but here it works
fine sometimes and sometimes the test just fails and
aftersometime i run it works.. so its not consistent,,, any
suggestion

Unknown said...

what is the difference between the above three commands?

Post a Comment

/* Tynt Insight tracker ----------------------------------------------- */