Fetch rows and column values from a custom built table in AngularJS web application
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Abhi,
My real condolences...
This is a way how Angular works and how developers use it (and how architects design the application) - by default, Angular assigns no identification properties to the generated elements. Sometimes developers may assign some additional value to the web element's class property, but quite often this value is too generic and does not allow unique identification.
Unfortunately, as per my experience, you have only two options:
1) Talk to Development/Architects, explain them why unique identification properties (id or name) are needed for web elements and make this properties be generated;
2) Your only option to find the needed element on the page will be search by displayed text. (Yes, slow, hardly localizable, hardly reusable, etc. but this is Angular and 'modern way' of development.)
P.S. As I wrote in another thread, there is third option - develop some test(s) and go for seek leave for a week or two leaving developers to support your code. I bet that in several days the magic will happen and a lot of (if not all) page elements will get their unique IDs.
P.P.S. To all audience: This given case is an excellent example of why QAs / tests automators *must* participate on the project stage where development tools, technologies and requirements for them are discussed and approved. Been a member of such discussion, you will be able either to influence on the set of tools/technologies, or add the requirements that will make your life easier and improve work results or at least warn the management about risks and ensure that these risks are properly counted.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
AlexKaras wrote
P.S. As I wrote in another thread, there is third option - develop some test(s) and go for seek leave for a week or two leaving developers to support your code. I bet that in several days the magic will happen and a lot of (if not all) page elements will get their unique IDs.
Recently, This is happened for me
Thanks @AlexKaras for the valuable words.
Thanks
Shankar R
LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com
“You must expect great things from you, before you can do them”- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Alex!
I completely understand that situation and I'd be talking with the Architects and the designers. probably, we'll have to live with the way Angular JS controls work.
But, the good News is, I found another way to make it work and I was able to fetch the right row count and the required info from the table, and was able to get the size of it even when it's dynamic. I also came across some other facts with these type of controls which irritated me a lot. But after all that pain, it's working for me. Another thing with this type of control is, if you want to take some help from the DOM, even there it doesn't load all the rows at any given point in time. It displays the rows in the table on the UI dynamically based on how you scroll(up-down/left-right).
I used the Object.EvaluateXpath and to make the whole table load(doesn't happen unless you scroll back to the first item in the table) in the DOM and then calculate the size of it, I'm getting to the bottom of the table by using ScrollIntoViewIfNeed() on the first item(because I see the last/latest row when the table is displayed on the UI).
Thank you again for everyone's contribution to this thread.
Thank you
Abhi
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Abhi,
Thank you for the status update and hints provided.
In my case we also ended up with mostly using .EvaluateXpath() but, unfortunately, mostly searching for the displayed text.
There were already several threads on this forum where people struggled with Angular, so I think that others may benefit from the ways you have found to identify Angular controls on the page. Obviously, if they are not confidential, too implementation specific and may be shared.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when i try to retrieve value from the cell using -
tableObject.Cell(tableObject.RowCount-1, 0)
I'm getting an error object not callable. Do you know how this can be resolved?

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »