Forum Discussion
Instead of what you have, do this:
function main() { var browser,page,form,Driver; Browsers.Item(btFirefox, "", Browsers.pX64).Run("AppURL"); browser = Aliases.browser; Driver=DDT.CSVDriver("C:/Users/Manoj.S/Desktop/Test complete forum doubts/RVData.csv"); while(!Driver.EOF()) { page=browser.pageWelcomeToReferralvalet8; loginClick(page,browser); page = browser.pageWelcomeToReferralvalet7; adminLogin(page,form,browser,Driver.Value('UserName')); Driver.Next(); } } function adminLogin(page,form,browser,userName) { var textbox; var table; var panel; page.Wait(); form = page.formAspnetform; textbox = form.textboxTxtusername; textbox.Click(78, 12); textbox.SetText(userName); }
There's no need to pass the driver object to your other function, just send in the value of the column.
Note also that I changed the call to Driver.Value to use the column header rather than the index (the index you had before was incorrect anyways since the username is column 0, not column 1).
Technically speaking, what you did before SHOULD have worked with the only problem being that you would be sending the password as the username. So, I guess the next question is... with what you had before... what was NOT working?
I have updated my script as you said.
but Error Occurs "Item cannot be found in the collection corresponding to the requested name or ordinal"
function adminLogin(page,form,browser,Driver,userName)
{
var textbox;
var table;
var panel;
page.Wait();
form = page.formAspnetform;
textbox = form.textboxTxtusername;
textbox.Click(78, 12);
textbox.SetText(userName);
}
function main()
{
var browser,page,form,Driver;
Browsers.Item(btFirefox, "", Browsers.pX64).Run("http://sysnetportal1/RVTesting_1/");
browser = Aliases.browser;
Driver=DDT.CSVDriver("C:/Users/Manoj.S/Desktop/Test complete forum doubts/RVData.csv")
while(!Driver.EOF())
{
page=browser.pageWelcomeToReferralvalet8;
loginClick(page,browser);
page = browser.pageWelcomeToReferralvalet7;
adminLogin(page,form,browser,Driver.Value('UserName'));
Driver.Next();
}
}
I have attached my CSV file for your reference:
When i tried to print column name using script :
temp=DDT.CurrentDriver.ColumnName(0);
Log.Message("Value of column is " + temp);
Message shown as "Value of column is UserName_Password ", why both column has combined
when i tried to access DDT.CurrentDriver.ColumnName(1);
Again Error occurs as "Item cannot be found in the collection corresponding to the requested name or ordinal"
Can you please on this, to retrieve my Username and password in CSV file.
- tristaanogre8 years agoEsteemed Contributor
The reason being is that it looks like you file is using some other delimiter than a comma to separate your columns. What delimiter are you using?
If you're using a delimiter other than a comma, you need to specify the delimiter or other necessary information in a schema.ini file stored in the directory with your CSV file. See https://support.smartbear.com/testcomplete/docs/testing-with/data-driven/csv-storages.html
- Manojrsr8 years agoContributor
Thanks for Information. As you said, i have made Changes in CSV File using delimiter. now i can able to Read data and pass value to script
Related Content
- 3 months ago
Recent Discussions
- 2 days ago
- 2 days ago
- 5 days ago