Ask a Question

Fetch rows and column values from a custom built table in AngularJS web application

Adagio
Frequent Contributor

Fetch rows and column values from a custom built table in AngularJS web application

Hello,

 

I'm trying to read the rows and columns of a custom built table in an Application. This is a dynamic table and the number of rows keep increasing or decreasing based on certain actions. I'm trying to read the first column of the last row in the table and for that I tried using the object spy. here the object recognizes each of the rows in  the first column as Cell(0,0). I'm not able to come up with any unique way to identify the newly added rows. 

 

Also, I checked for the unique properties, but I don't see any which would identify the cell as unique.

 

I also tried looking at other such questions posted on the community, but nothing helped so far. 

 

any help would be greatly appreciated

 

Thank you

Abhi

14 REPLIES 14
tristaanogre
Esteemed Contributor

If you are finding the "Cell" within the table, then it should respond to standard table properties.  This means your table object should have a RowCount property.

 

So, if you want to read the first column of the last row, you should do something like this:

 

tableObject.Cell(tableObject.RowCount-1, 0)

 

EDIT: Since your table is dynamic in rows, the above method is the recommended method for getting to any particular cell.  Mapping the cell will not get you what you want since that first number will be changing every time.  When it comes to dynamically generated content like this, it's best to map the parent object (in this case, the table) and use code expressions like what I've noted to get to individual cells. 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Adagio
Frequent Contributor

Thanks Robert

 

As I explained in my post that no matter which row I'm looking at every cell in the first column is mapped as Cell(0,0) so RowCount doesn't help here. for more Info please have a look at this one: ColumnIndex and RowIndex is always set to 0

 

Cell Identification problem.PNG

 

Thank you

Abhi

Instead of mapping unique cells, If you know what entry[one unique column value is enough] is going to add it your table, then you find them with the expected values and see whether those entry got reflected in table or not.

 

If you are not sure what values going to add, You can't validate it right way but you can validate with assumption that it is inserting it lastrow.


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

Adagio
Frequent Contributor

nope..I wouldn't know what data might appear in the table. it's all being auto-populated by restful services and the size is never the same...sometimes there are 8 rows and sometimes there are 3 rows. I would want to read the value of Cell in first column after reading the corresponding status in the same row in second Column. 

 

 

CustomTable.PNG

 

 

 

 

Thank you

Abhi

tristaanogre
Esteemed Contributor

What you are looking at there is not the mapping, it is the object browser.  Can you give us a screenshot showing the table object in the object browser with the child objects expanded?  It should look something like:

2017-06-01 12_40_55-Clipboard.png

 

Basically, what I'm suggesting you do is to not use Object Spy or any other way of grabbing the cell directly from the screen but to enter in the code as I showed in my first response.  In my example above, my Table has these properties:

 

tablepropertiespjs.png

 

Do you have similar properties?

 

 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Adagio
Frequent Contributor

Sure Robert..here's the screenshot. you'll see that here only columnindex would change, and rowIndex would always remain 0

 

CustomTable.PNG

 

Thank you

Abhi

tristaanogre
Esteemed Contributor

Wow... that's a strange looking table where the child objects of the table aren't cells but are panels... that's those extra div tags in the HTML.. really bizzare way of building a table.

 

In any case, we'll have to look elsewhere for the properties...  with the desired cell highlighted, what happens if you go to advanced view (there's a link at the top of the properties panel)?  What other properties are available that we could perhaps look for?


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Adagio
Frequent Contributor

Thank you Robert! I felt the same way about this object. Even after using 'Advanced' it doesn't help. I've to talk with the architects to make it better.

 

appreciate your help.

Thank you

Abhi 

Sometimes you can execute the 'getItemCount()' method to get the # of rows/items from the table.  I've have some success using this with SWT controls.  This might not be available for the custom Angular controls. 

cancel
Showing results for 
Search instead for 
Did you mean: