Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to find out row,column values to use GetCellData method
#1
Solved: 11 Years, 4 Months ago
I have an application and i am trying to capture a value which is inside the webtable. I am planning to use GetCelldata(row,column). When i try to use object spy on the object to find out the row and column values it doesnt list in either To properties or Ro properties of the object. Please help me how to find row,column values.
Reply
#2
Solved: 11 Years, 4 Months ago
Usually the columns and rows count either start with 0 or 1.
so Trail and error is the best possible method, i guess.
Reply
#3
Solved: 11 Years, 4 Months ago
@ Quickmy,

can you elaborate ur question please....????
As niranjan said, you can start with 1 (most probably) and put the value in variable and cross check the value in the variable (by "watch"ing the variable)
Reply
#4
Solved: 11 Years, 4 Months ago
Thank you very much for the reply
I was using the previous thread's example appln http://www.seafight.com/
and trying to retrieve Online Now value ie 14.894

I am using

Code:
strCellData = Browser("Seafight.com – Online").Page("Seafight.com – Online").WebTable("Deutsch").GetCellData(row,column)

My doubt was how to decide on the values of row and column, Is it just the guess work?
Reply
#5
Solved: 11 Years, 4 Months ago
Hi quickmy,

on looking at the link you have provided, the table has 3 columns and 6 rows....
Now either you have two options of hardcoding the value.

Either hard code the value of rows and columns.
say look for the data in row-2 and col-3
Or else verify for the value "ONLINE NOW:" (which is also hardcoding the data you are looking for) and in that row check for the value in the column 2 or 3.

For finding the row value, you need to have a for loop to match the value you need.

this either 2 or 3 is a guess.. you have to play around to find it out.
Once it is discovered i dont think the column values are going to be changing... only the row values can change...

Let me know if you can understand my logic.
Reply
#6
Solved: 11 Years, 4 Months ago
Code:
TableRowCount = Browser().page().WebTable().RowCount
TableColCount   = Browser().page().WebTable().ColumnCount
For i = 0 to TableRowCount-1
    For j = 0 to TableColCount-1
        CellValue = Browser().page().WebTable().GetCellData(i,j)
        Print "Row number - "&i
        Print "Column number - " &j
        Print CellValue
    Next
Next
Reply
#7
Solved: 11 Years, 4 Months ago Smile 
Hi swame_sp,prince3105,

Thank you so much for the explanation and the code, i got it right.
Here is what i have written

Code:
RCnt = Browser("Seafight.com – Online").Page("Seafight.com – Online").WebTable("Deutsch").RowCount
For i=1 to Rcnt
msgbox i
CCnt = Browser("Seafight.com – Online").Page("Seafight.com – Online").WebTable("Deutsch").ColumnCount(i)
For j=1 to Ccnt
strCellData = Browser("Seafight.com – Online").Page("Seafight.com – Online").WebTable("Deutsch").GetCellData(i,j)
Next
Next
'Using watch i get the i,j values ie 2,3 and i use them in GetCellData method
strCellData= trim(Browser("Seafight.com – Online").Page("Seafight.com – Online").WebTable("Deutsch").GetCellData(2,3))
strSplitData = split(strCellData," ",3,0)
onlineNow = strSplitData(0)
Msgbox(onlineNow)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  DataGrid: double click on selected row robertosalemi 0 4,437 05-12-2016, 03:00 PM
Last Post: robertosalemi
  Row count is always shown as 1 Harry1999 0 2,093 04-14-2016, 11:11 PM
Last Post: Harry1999
  [UFT] Get column name from SfwObject felino 0 3,023 12-02-2015, 04:07 PM
Last Post: felino
  AddParameter method does not add in first column of datatable alpha1 4 5,588 07-14-2015, 12:44 AM
Last Post: supputuri
  Keep row number imbizile 0 2,756 09-18-2014, 03:31 AM
Last Post: imbizile

Forum Jump:


Users browsing this thread: 3 Guest(s)