Ask a Question

How to get hidden rows in dynamic web grid or table

funmay
Contributor

How to get hidden rows in dynamic web grid or table

How can i get value in a dynamic table,i am able to  use RowCount and Column count.

But this only work for visible data/rows on the screen,they are hidden rows and the hidden rows/data can only be seen until user scroll to the last visible row on the screen.

Also the RowCount, will only get the number of the rows of data on screen not the hidden rows/data while they are many rows.

The next hidden rows can be seen until user looping through the last visible row.

Can some help me with code in TestComplete Javascript

5 REPLIES 5
tristaanogre
Community Hero

Re: How to get hidden rows in dynamic web grid or table

Your best bet is to build a routine that will use a PageDown or scroll down command in the table where you will search the table for desired values, if not found, scroll down... rinse and repeat.

 

Without knowing the specifics of your table, exact code is not possible but I'm thinking it would be something on the lines of either a for loop or a while loop.


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
funmay
Contributor

Re: How to get hidden rows in dynamic web grid or table

Thank you for your reply. A sample code would have been better.

tristaanogre
Community Hero

Re: How to get hidden rows in dynamic web grid or table

Sample code..... this is PURELY pseudo code, untested, simply to give the basic idea.  This is where I would start but, as indicated above, specifics will have to be up to you to implement based upon the object, methods available, etc.

 

function findItemInTable(tableObject, stringToFind, columnToSearch){
    var itemFound = false;
    while (!itemFound){ //might need an additional check here to determine when you've reached the bottom of the table, possibly based upon some sort of record number displayed or gathered from somewhere else
        for(var i=0;i < tableObject.RowCount; i++){
            if(tableObject.Cell(i, columnToSearch).contentText === stringToFind){
                itemFound = true;
                break;
            }
        tableObject.scrollDown; //Don't know what command to use here.  Could be a Keys to use Page Down, may be a native function to page down, might be interacting with a scroll bar.  You want to make sure whatever is implemented will go down a full page
        }
    }

}

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
funmay
Contributor

Re: How to get hidden rows in dynamic web grid or table

Thank you for your reply.I am new Testcomplete, i do not know what i need to do with your sample code .

 

I need code how to iterate/get values from hidden rows of a table.I can only get actual row counts only for the on screen rows,but if scrolling down manually from the last row and another hidden row will be visible on screen,the first previous row will be hidden.

The table has only 20 rows attribute, the on screen and hidden rows are dynamically looping within the same 20 attributes by scrolling down.

The sample below code can only iterate only on the on screen rows not the hidden rows. Base on the code you sent,where do i need to apply it to the below sample code please.

 

var rows=browser.FindChildByXpath(xPathtable);
var cols =browser.FindChildByXpath(xPathColumn);


for (int i =1;i<rows.RowCount;i++) { 
 for (int j =1;j<col.ColumnCount;j++){
var Details=browser.FindChildByXpath(tablexPath+"//tr[" + i + "]/td[" + j + "]");
Details.innerText;



tristaanogre
Community Hero

Re: How to get hidden rows in dynamic web grid or table

Well, you're using an entirely different way of iterating the objects than I am.  I'm going simply by rows, searching only a single column until I find the text I'm looking for.  I'm looping through those twenty rows.  If I don't find it in that 20, I then send a command to scroll down the table.  

 

I repeat that I don't know the specifics of your application, table type, etc.  So... depending upon how the control is rendered, the specific code itself is going to have to be up to you.  If you want us to be more specific, please provide screenshots of the Object Spy for your table object including all properties and methods.  

 

Basically, if you don't find it in the 20 rows, you send whatever command you need and then repeat the loops.  Given your code that you provided, I would put a while loop like I have around your nested for loops.  Within your second for-loop would be your check to see if you found what you wanted.  If so, set the boolean and break the for loops.  Within the while loop, if the boolean isn't true, send the necessary command to your table to scroll down the table to get the next set of 20 rows.

 

The only thing out of all this that is TestComplete specific is whether or not you use a "Keys" command to send a "PageDown". Everything else is JavaScript.


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
cancel
Showing results for 
Search instead for 
Did you mean: