05-19-2014 11:37 AM
I am trying to search a specific folder in D:\test directory using QTP. I did spy on the folders. It seems to me all the folders in a containter object. QTP does not recognize folders seperately. Any help?
Solved! Go to Solution.
05-19-2014 02:43 PM
Are you using QTP to interact with a Windows Explorer dialog, or are you using vbscript code to interact with the file system?
(Opinions expressed in my postings are mine alone, and do not reflect the opinions of my employer.No warranties express or implied for any solution/suggestion posted.)
05-20-2014 09:50 AM
I am using qtp 11.
Not sure what to answer to your question.
Example: In C:\Test directory, folders are being created automatically from a VB application. Each time VB application creates a folder, I need to come to C directory to verify whether the folder was created.
Folders names will be test1, test2, test3, qtp1, qtp2, qtp3.
When a new folder gets created with prefix test, the next folder name will be test4. When a new folder gets created with prefix qtp, the fourth qtp folder name will be qtp4, so on.
I need QTP to find out whether the new folder has created with the same prefix in the given directory.
05-23-2014 10:25 AM
You can use filesystem to get that.
Set fso=createobject("Scripting.FileSystemObject") 'Folder for getting details Sourcefolder="C:\Test" Set get_folder=fso.GetFolder(Sourcefolder) 'get the subfolders count in a folder Set get_subfolder=get_folder.SubFolders For each folder in get_subfolder 'compare folder name If folder.name = "expected value" then 'process to do end if Next Set fso=nothing
If you find that this or any post resolves your issue, mark it as an accepted solution.
The code provided above is free and is just a sample, you need to adapt it and maintain it according to your needs.
Also remember if you have a valid contract with HP feel free to visit our FT/QTP Support Customer Forums:
You can create an account with your HP credentials