Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to generate QTP report in a new file(html)?
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi,,
I have code which will create a html file for reporting and updating logs in the report. but everytime i run the script this report is overwritten.
My requirement is everytime i run the script it should generate a new file and NOT overwritten.
Please help with the code.
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi ,

While creating a HTML file why cant you use 'now()' property to give unique name to the file.

like :

Code:
FileName = "D:\HtmlReport_" &  replace(replace(replace(now() , "/" , "_") , ":" , "_") , " " , "_") & ".html"
and then use it in the file creation

Code:
Set objFS_TestSet = CreateObject("Scripting.FileSystemObject")
Set objReport_Set = objFS_TestSet.OpenTextFile(FileName, 2, True)

Thanks,
Harish
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Harish, i tried below code but its saying "path not found"

Code:
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")
path1="D:\QTP_R22\DDF\Report\gsReportFile" & now() & ".html"
Set objTextFileObject= objFileSystemObject.CreateTextFile(path1,True)

What might be the issue?
Reply
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Try the below

Code:
TS = replace(replace(replace(now() , "/" , "_") , ":" , "_") , " " , "_")
Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")
path1="D:\QTP_R22\DDF\Report\gsReportFile_"&TS& ".html"
Set objTextFileObject= objFileSystemObject.CreateTextFile(path1,True)
Reply
#5
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi ,

Here u used only 'now()' that includes 'space' in that also....U need to replace the space with any other charectors like '_' , because if any space encounter in the URL then browser will not recognize the path of that , u can avoid space using 'replace' key word , like I have mentioned in the previous post , use the below code in place of 'now()' (just replace now() with the below code)

like :
replace(replace(replace(now() , "/" , "_") , ":" , "_") , " " , "_")

you will be able to get the report sucessfully.


Thnanks ,
Harish
Reply
#6
Solved: 11 Years, 3 Months, 4 Weeks ago
Thanks a alot. its working.Smile



Thanks a lotSmile its workingSmile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Customized HTML reports in QTP azeem 11 49,498 12-31-2016, 02:57 PM
Last Post: chevronneraji
  [UFT] Get text into DIV through HTML tag robertosalemi 2 5,533 03-29-2016, 09:43 PM
Last Post: robertosalemi
  Report Viewer showing hundreds of WebElement.Exists? themoon 1 2,347 03-09-2016, 02:43 PM
Last Post: vinod123
  How to attach HTML file to Email Naresh 0 3,070 04-06-2015, 02:04 PM
Last Post: Naresh
  Unable to generate Scripts using QTP11 Divya Roopa 1 2,090 03-05-2014, 09:07 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 2 Guest(s)