QTP Interview Questions and Answers
Question - 81 : - Mention the steps required in UFT to send mail from outlook?
Answer - 81 : -
To send mail from outlook in UFT,
Set Outlook = CreateObject ("Outlook.Application")
Dim Message 'As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = Subject
.HTMLBody = TextBody
.Recipients.Add (aTo)
Const olOriginator = 0
.Send
End With
Question - 82 : - What are the codes we can use to get files from ftp server in UFT?
Answer - 82 : -
To get ftp files from ftp server, you have to use below code
a) put- To store single file on server
b) get- To download single file from ftp server
c) mget- To download multiple files from server
d) mput- To store multiple files on server
e) delete- To delete files on ftp server
MyShell.Run "%comspec% /c FTP -n -s:" & commandstoworkwithftp & " " & Site, 0,True
Question - 83 : - In UFT how you can prevent the system from getting locked?
Answer - 83 : -
To prevent system getting locked, any of the two ways can be used
- Create a simple vbs file having code to press numlock key and run that vbs file
- Edit one registry key “DisableLockWorkstation =1” to disable locking
Question - 84 : - What is descriptive programming in UFT means?
Answer - 84 : -
Descriptive programming includes property name and property value. Whenever UFT is facing difficulty in identifying objects from object repository, and instead the object is directly identified from the script is known as descriptive programming.
Question - 85 : - In UFT explain the difference between qfl and vbs files?
Answer - 85 : -
a) qfl is quick test function library file while vbs is Microsoft’s vbscript
b) qfl is a non-executable file while vbs is an executable file
c) To use file in UFT associate qfl file from test setting, while to include vbs file use “execute file statement”
Question - 86 : - What is the code to write data to text file in UFT?
Answer - 86 : -
To write data to text file in UFT code is
Content = “Rocks”
Set Fo = createobject ("Scripting.FilesystemObject")
Set f = Fo.openTextFile ("c:\myFile.txt",8,true) ' open in write mode
f.Write (contents)
f.Close
Set f = nothing
Question - 87 : - How to write data to excel file in UFT?
Answer - 87 : -
Code to write data to Excel file in UFT is
filepath = “C:\Bugs\Reports.xlsx”
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible= True
Set Wb= objExcel.Workbooks.Open (filepath)
Wb.worksheets(1).Cells(1,1).Value = “interview” read value from Excel file
Question - 88 : - How to create excel file in UFT ?
Answer - 88 : -
steps will create excel file in UFT,
'Create a new Microsoft Excel object
Set myExcel = createobject("excel.application")
'To make Excel visible
myExcel.Application.Visible = true
myExcel.Workbooks.Add
MyExcel.worksheets(1).Cells(1,1). Value = “Scenario Id”
MyExcel.worksheets(1).Cells(1,2).Value = “Scenario Name”
MyExcel.worksheets(1).Columns(1).ColumnWidth = 10
MyExcel.worksheets(1).Columns(2).ColumnWidth = 40
MyExcel.worksheets(1).Columns(3).ColumnWidth = 20
MyExcel.worksheets(1).Columns(4).ColumnWidth = 20
MyExcel.SaveAs "c:\Filename.xlsx"
MyExcel.close
objExcel.Quit
blnFlag = False
Question - 89 : - How to find the total number of rows in the webtable in UFT?
Answer - 89 : -
There are three ways which we can find the count of rows in the table in UFT
a) Using rowcount property of UFT webtable object
b) Using GetROProperty of UFT
c) Using HTML DOM + UFT
Question - 90 : - What is round function in UFT?
Answer - 90 : -
Round function in UFT is used to round the decimal
For example
- Mydecimal = 6.3433333
- Roundedvalue= Round(Mydecimal , 3)
- Print roundedvalue, it will print 6.343