I want to select 2nd row of table and enter data in column because 1st row is disable and if 2nd row contains then it auto clicks on 3rd row. My code selects 1st row every time
Your code is selecting the first, uneditable row every time because it contains the same class as your row to select. If cy.get()
returns multiple elements, then the first one is yielded to the subsequent commands if a specific element is not specified. So, we can get around this by specifying .eq()
.
cy.get('#TWGanttArea')
.find('.taskEditRow') // use find, because get always starts from root
.eq(1) // yields the returned element at the index-0'd 1 position
.find('td.taskTitle') // finds child elements of type td with class taskTitle
.type('foo');