Qtp launch
Upcoming SlideShare
Loading in...5
×
 

Qtp launch

on

  • 1,839 views

Ways of Launching Applications in QTP, using SystemUtil.Run, InvokeApplication and using Shell Object

Ways of Launching Applications in QTP, using SystemUtil.Run, InvokeApplication and using Shell Object

Statistics

Views

Total Views
1,839
Views on SlideShare
1,837
Embed Views
2

Actions

Likes
0
Downloads
15
Comments
0

2 Embeds 2

http://www.slideshare.net 1
http://www.techgig.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Qtp launch Qtp launch Document Transcript

  • Visit: http://qtp12.blogspot.com/ Ways to launch your applicationFour different ways to launch your application are mentioned below:1) SystemUtil.RunSystemUtil.Run ( FileName, Parameters, Path, Operation )FileName - The name of the file you want to run.Parameters - If the specified FileName is an executable file, use theParameters argument to specify any parameters to be passed to theapplication.Path - The default directory of the application or file.Operation - The action to be performed. If this argument is blank (""),the open operation is performed.The following operations can be specified for the operation argumentof the SystemUtil.Run method:open - Opens the file specified by the FileName parameter. The file canbe an executable file, a document file, or a folder. Non-executable filesare open in the associated application.edit - Launches an editor and opens the document for editing. If theFileName argument does not specify an editable document file, thestatement fails.explore - Explores the folder specified by the FileName argument.find - Initiates a search starting from the specified folder path.print - Prints the document file specified by the FileName argument. Ifthe specified file is not a printable document file, the statement fails. 1
  • Example:SystemUtil.Run "D:My MusicBreathe.mp3","","D:My MusicDetails","open"2) InvokeApplicationThis command is now mainly used for the backward compatability ie touse with the lower versions(below QTP 6.0) of QTP.InvokeApplication("Full URL as Parameter")Example:InvokeApplication "C:Program FilesInternetExplorerIEXPLORE.EXE http://www.yahoo.com"3) VBscript to invoke application1. Create a "WScript.shell" object.2. Use the "run" object to launch the application. If the path to yourexecutable contains spaces, use Chr(34) to ensure the path iscontained within double quotes.3. When done, set the shell object to nothing to release it.Example:Dim oShellSet oShell = CreateObject ("Wscript.shell")Example 1 - run a batch file:oShell.run"F:jdk1.3.1demojfcSwingSet2.bat"Example 2 - run a Java jar file:oShell.run "java -jar F:jdk1.3.1demo 2
  • jfcSwingSet2SwingSet2.jar"Example 3 - launch Internet Explorer:oShell.Run Chr(34) &"C:Program FilesInternet ExplorerIEXPLORE.EXE" & Chr(34)SetoShell = Nothing4) Trivial but useful methodIf nothing works out you might try thisYou can use the Start -> Run dialog of Windows.1. Add the Windows Start button to the Object Repository using the"Add Objects" button in Object Repository dialog.2. Open the Run dialog (Start -> Run), and learn the "Open" edit fieldand the "OK" button into the Object Repository.3. Switch to the Expert View, and manually add the lines to open theRun dialog.Example:Window("Window").WinButton("Button").ClickWindow("Window").Type("R")4. Manually enter the lines to enter the information to launch theapplication, and click the "OK" button of the Run dialog.Example:Dialog("Run").WinEdit("Open:").Type"c:WINNTsystem32notepad.exe"Dialog("Run").WinButton("OK").Click 3
  • If you want to keep track of further articles on QTP. I recommend youto subscribe via RSS Feed. You can also subscribe by Email and havenew QTP articles sent directly to your inbox. 4