Forum Discussion

seanMRoss's avatar
seanMRoss
Contributor
12 years ago

Getting textContent from the a panel nested in a cell

Hi



I have a grid that can have a maximum number of rows =17



I want to be able to iterate through each each panel and get the text content from the cell(0,x).



I have attached a screen shot of the object in the object browser.



Thanks in advance!

Sean

2 Replies

  • Hi Sean,



    I assume you want to do it via a script, but I'm sure you can solve it via Keyword Testing too.



    Follow these steps:


    1. Get parent object (in the screenshot, Panel("ext_gen114").Panel(0).Table(0)). You can use many methods, such as Find or the full object name.


    2. Create a loop to iterate all the cells, and retrieve the innerText.


    For example, in JavaScript:



    var parent = Sys.Browser("*").Page("*")...Panel("ext_gen114").Panel(0).Table(0);



    var i = 0;



    while (...) {

      var text = parent.Cell(0, i).innerText;

      // Do whatever you need

      i++;

    }





    You can also store all the innerText values in an array if you want to.



    It should do the trick!