Sunday, May 10, 2009

Import file with Pathfinder command.

We can import files (Excel, VBS, XML, etc.) from Local machine and Quality Center to QTP.

First we have to do settings in QTP with below navigation
Tools --> Options --> Folders and click on “+” and add specified folder path.

In code wherever we are using “Import” command there use below code.


Dim QTPApp, SearchPath
Set QTPApp = CreateObject("QuickTest.Application") ' Create the Application Object
QTPApp.Launch ' Start QTP

QTPApp.Folders.Add(“C:\FolderNmae")' Add the folder for Search list

SearchPath=pathfinder.Locate("FileName.xls") ' Locate the folder Path
datatable.ImportSheet SearchPath,1,1
set QTPApp =nothing 'Release the Application Object

No comments:

Post a Comment