I have an angular grid with 3 rows. All three rows come under same class A. but ever row has it xpath webelement B (//div). How to iterate through each cell of 1st two rows and get the values in an array? Please help me in this.
There is no repeater. When I tried using getting text of each cell of 1st row using div xpath webelement B then it is giving me result like this:
cell1
cell2
cell3
But I need result in this format
['cell1', 'cell2', 'cell3']
and when I get text of class A then it is giving me in proper format but all the cells of 3 rows are coming. like ['cell1', 'cell2', 'cell3', 'cell6'........]
I have written like this:
var expectedCells = element.all(by.css('.A); - using class A
expectedCells.each((eachCell) => {
eachCell.getText().then((cellText) => {
expect(expectedCells).toEqual([['cell1', 'cell2', 'cell3'])
});
})
Expected: ['cell1', 'cell2', 'cell3']
Actual: giving me last cell text only