Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading Values from csv file and excel file
#1
Not Solved
I would like to apologize if this is something that was already asked. I was unable to find them in the forums, therefore i am posting here.

I have simple login procedure by entering emailaddress and password in our windows application. I can easily parametrize these values in the datatable and use these values.
However i would like QTP to gather these values from a csv file/ excel file.

1. So if i have a simple csv file such as:

emailaddress user!@testing.com
password 1234abcd

What is the best way to gather this data, and apply it to a given textbox in the application.


2. Same scenario as above, how would i gather this from a xls file.


Your help is very much appreciated.

Thanks,
rd
Reply
#2
Not Solved
Just want to clarify the post above.

It would be very helpful to know a way to gather a username and password from an xls sheet, import it into the data table in runtime and then read those values from the datable into a enter in the windows application.
Reply
#3
Not Solved
Hi-
For Excel:
To load the table at runtime do this:
Datatable.AddSheet "NameYouGiveToARuntimeTable" ***Adds the Runtimetable with the given name
Datatable.ImportSheet "c:\YOURUSERNAMESANDPASSWORDS.xls", 1,"NameYouGiveToARuntimeTable" ****Imports the values of your spreadsheet into QTP at runtime. Be sure that you have a column Name for each Column (Email Address, Password)


To enter the value into the application you'll need either a loop or a conditional statement. QTP will attempt to use every row. So if the login is successful it moves forward, completes the test then reruns it with the second username and password.

A way to enter the data from the runtime datatable is this in a browser. For a windows application I am sure it's very similar:

Code:
Browser("NAME").Page("SomePage").WebEdit("TextBoxName").Set DataTable("Username", "NameYouGiveToARuntimeTable")
Browser("NAME").Page("SomePage").WebEdit("TextBoxName").Set DataTable("Password", "NameYouGiveToARuntimeTable")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  File Chooser on Chrome doesn't work - UFT 15.0.1 Nenna Rosa 1 3,304 10-31-2020, 01:16 PM
Last Post: Ankur
  File Pointers Reset When Using Subroutines zunebuggy 0 730 08-19-2020, 07:45 PM
Last Post: zunebuggy
  Reading Global Sheet's DataTable Value Bhuvana 0 1,463 01-05-2020, 10:03 PM
Last Post: Bhuvana
  How to export the output value of a webedit object to a new excel file. mounika6677 1 1,323 04-14-2019, 05:18 PM
Last Post: mounika6677
  Invalid file error importing xls file Makhado 0 1,183 10-04-2018, 04:33 PM
Last Post: Makhado

Forum Jump:


Users browsing this thread: 1 Guest(s)