Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HELP......
#1
in this script(below) i am not being able to use GetRowCount method as you can see before for loop i have two lines commented out where i tried to use GetRowCount method to run the script as many rows as it will get imported to the data table but couldn't. I had to use the actual number for the rows. what could be the reason? can anyone please help me solve this? and please if anyone could tell me if i wanted to use this for loop in function (as it show in the script on the top) instead of in the actual script what should be done?

thank you so much

btw i m using qtp 10 on win xp on ie6
Code:
'Declaring the function Function getdtvalue(mycoln) 'Add data sheet in the QTP Data Table DataTable.AddSheet ("mydt") 'Import the excel sheet into QTP Data Table DataTable.ImportSheet "C:\Documents and Settings\Administrator\Desktop\QTP\MyTests\Data Driven FrameWork With Excel\Data\TC_Gmail_Login.xls", tcnameinexcel,"mydt" getdtvalue=DataTable.Value(mycoln,"mydt") End Function 'dt=Datatable.GetSheet("mydt").GetRowCount 'msgbox dt For a=1 to 2 Datatable.SetCurrentRow(a) 'Datatable.SetNextRow tcnameinexcel=Environment.Value("TestName") systemutil.Run "iexplore.exe", getdtvalue("URL") Browser("Browser").Page("Gmail: Email from Google").WebEdit("Email").Set getdtvalue("UserID") Browser("Browser").Page("Gmail: Email from Google").WebEdit("Passwd").Set getdtvalue("password") wait 2 Browser("Browser").Page("Gmail: Email from Google").WebButton("Sign in").Click Browser("Browser").Page("Gmail - Inbox").Link("Sign out").Click Browser("Browser").Page("Gmail: Email from Google_2").Sync Browser("Browser").Close next
Reply
#2
You cant get the rowcount because, In "getdtvalue" method you are importing the data, whereas you are trying to find our the rowcount before it is called.

Move ImportSheet method(and corresponding steps) from the function and put it before the getrowcount method. You should be good to go.

Regards,
Uday
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)