Protractor: Unable to access a row and its column from a table

Created on 1 Oct 2014  ·  3Comments  ·  Source: angular/protractor

<div class="k-grid-content">
    <table>
        <tbody>
            <tr>
                <td>row1Col1</td>
                <td>row1Col2</td>
                <td>row1Col3</td>
            </tr>

            <tr>
                <td>row2Col1</td>
                <td>row3Col2</td>
                <td>row4Col3</td>
            </tr>

            <tr>
                <td>row3Col1</td>
                <td>row3Col2</td>
                <td>row3Col3</td>
            </tr>

        </tbody>
    </table>
 </div>
var grid = element.all(by.css('.k-grid-content tr')); //this will return row1,row2,row3

but I am unable to use code below to get each row and its column.

grid.each.each(function(row){
    var rowElems = row.findElements(by.tagName('td'));
    expect(rowElems.get(0).getText()).toMatch('/Col1/');
});

the following error message is displaying. Message: TypeError: Object [object Object] has no method 'findElements'

question

All 3 comments

Thanks @elgalu for the answer on SO!

@elgalu @juliemr In reference to the answer on StackOverflow , Its kinda strange that for me ".each" did not work instead ".filter" as in grid.filter(function(row) {
Any thoughts on this weird behaviour?

Was this page helpful?
0 / 5 - 0 ratings