Ad Home

Theme images by kelvinjay. Powered by Blogger.

Travel

Header Ads

Java

Selenium

UFT

Framework

General QA Concept

BDD

» » How To Pass User Input Values to Datatable in QTP

In this post , I would like to show how to take user input dynamically and save it to Excel sheet. In very rare cases, We see such thing.Most of cases where we need some manual intervention We will go with this approach.

The syntax to get data from user is ..
InputBox(prompt[,title][,default][,xpos][,ypos][,helpfile,context])
Please refer here for more on inputbox

Please refer here for all datatable methods
Please refer here Datatable Assignment.
DataTable.AddSheet("output")
'Will add a sheet during runtime
user_input=DataTable.GetSheetCount
'Create a variable how many sheets are present during run time
DataTable.GetSheet(user_input).AddParameter "Emp_No", ""
'Adding parameter as employee Number
DataTable.GetSheet(user_input).AddParameter "Emp_Name", ""
'Adding parameter as employee Name
DataTable.GetSheet(user_input).AddParameter "Emp_sal", ""
'Adding parameter as employee salary
For i = 1 to 3
    DataTable.SetCurrentRow(i)
' Setting the currentrow
    DataTable.Value(1,user_input) = inputbox("Please provide Employee Nummber")
'getting Employee number as input and storing that in the first column
    DataTable.Value(2,user_input) = inputbox("Please provide Employee Name")

    DataTable.Value(3,user_input) = inputbox("Please provide Employee Salary")

Next
You are done. Optionally You can export the sheet to local using exportsheet method.

«
Next
Newer Post
»
Previous
Older Post

No comments:

Leave a Reply