Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Relative Path problem
#1
Not Solved
Hi,
I am trying to use the relative path in qtp to open a excel file to take input from and maintaining a definite folder structure. But on using this function
getabsolutepath in qtp gives C:\Program Files\HP\QuickTest Professional\bin
as my current working directory. How to use my script path as the current working directory, I have tried added the path in Tools->Options->Folder but it sometimes open C:\Program Files\HP\QuickTest Professional\bin as my current working directory.
Thanks
Reply
#2
Not Solved
Code:
TestDir=Environment.Value("TestDir")
TestNameLength=Len(Environment.Value("TestName"))
TestDir=Left(TestDir,Len(TestDir)-TestNameLength)
Set excel = CreateObject("Excel.Application")
InitFilePath=TestDir+"\Init\Init.xls"
Set workbook = excel.Workbooks.Open(InitFilePath)
Set worksheet=workbook.Worksheets("Sheet1")
Set url = worksheet.Cells.Find("url")
urladd= worksheet.Cells(url.row,(url.column)+1)
excel.Quit
SystemUtil.Run urladd

my test directory(folder) is "Test" and am having a folder named "Init" beside my test folder. there i am having a excel file "Init.xls" to store url of the application. i read it using the above code. the idea is, i have used the
predefined environment variable "TestDir" for my logic.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to get relative path by using testdir environment variable Sathyaprasad 1 1,938 11-30-2017, 02:21 AM
Last Post: supputuri
  Path of Flight reservation Window is not recorded in HP UFT 12.52 version mailtokopalverma@gmail.com 1 2,697 04-01-2016, 05:34 PM
Last Post: vinod123
  X path Identification vasavi.vasavi 1 2,986 07-29-2015, 10:44 AM
Last Post: kbhargava505
  environment variable path for qc automation2012 0 2,866 01-18-2015, 08:18 AM
Last Post: automation2012
  Change Object Repository File Path for ExternalActions MasterChief 1 4,683 11-13-2014, 06:05 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)