How to create log file in qtp?

Answers were Sorted based on User's Feedback



How to create log file in qtp?..

Answer / naveen

Using CreateTextFile method of File System Object property.
we can create a log file and write the data into it.

Sub CreateAfile
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)
MyFile.WriteLine("This is a test.")
MyFile.Close
End Sub

Is This Answer Correct ?    7 Yes 4 No

How to create log file in qtp?..

Answer / keerthykannan

Dim fso,objLogFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set objLogFile = fso.OpenTextFile ("C:\Log" &var
&".txt",2,true)
objLogFile.Writeline(time)
objLogFile.Close

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More QTP Interview Questions

Difference between copy to action and call to action?

0 Answers  


hai friend's .. my question is a[0]=I a[1]=N a[2]=D LIKE IT GO'S i need output INDIA ,using simple string how will u do? can any one tell really need full..

4 Answers   Mind Tree, Tech Mahindra,


what is mercury.clipboard in qtp.where we can get this in qtp tool i.e tabs

1 Answers  


The string is like POWER STAR PAVAN , write a script for this how to findout the number of "A" in the string ?

7 Answers   TCS,


Explain about Test Fusion Report of QTP?

0 Answers  






I am facing an issue of object identification with the dropdown element of DHTML grid. When I tried to recognize these different dropdown objects, QTP identifies only one object for all the dropdowns. Hence, selection of different data from different dropdowns list is an issue. To overcome this problem, i have used Descriptive Programming technique by creating different object descriptions which have all the other properties same but differ only in one property i.e. ‘X’ location of the element on the screen. Hence, i have created distinct object descriptions that would allow us to select values in different dropdowns. The code is given below. But still I am unable to identify distinct dropdown objects. ‘Object Description for Dropdown Cell Status Set objCellStatus = Description.Create objCellStatus("micclass").value = "WebList" objCellStatus("name").value = "select" objCellStatus("x").value = 219 ------ ‘X’ Axis value for cell status drop down ‘Object Description for Dropdown Sub Segment Set objSubSegment = Description.Create objSubSegment("micclass").value = "WebList" objSubSegment("name").value = "select" objSubSegment("x").value = "319" ------ ‘X’ Axis value for sub segment drop down Please help... This is specific to DTML grid(Drop down object)

0 Answers  


Other than using import sheet statement for importing the data from excel sheet, is there any other method that can be used?

2 Answers  


How to find the OS name by using QTP script?

2 Answers   IBM, Tech Mahindra,


HOW TO FIND WEBTABLE? HOW TO RETRIVE THE WEBTABLE VALUES? PLZ TELL ME THE PROCEDURE.

2 Answers   TCS,


What is the use of low level recording? How does it useful?

1 Answers  


How to handle the exceptions using recovery secnario manager in quicktest professional?

0 Answers  


Which line will be executed 1-B(DP).P(OR.link(DP) 2-B(OR).P(Or).Link(DP)

2 Answers   Broadridge,


Categories