mardi 29 janvier 2019

How can I access a cousin element, of an element with an identifier in Cypress

I am trying to click a check box in a list of Table rows snapshot of the HTML the only way I can think to access this level is by the span tag with its corresponding name.

cy.get('tr > td > span').contains('newCypressTestCore').siblings('td > input').click();

although this would only return the siblings of the span tag when i actually need to access the cousin of the span tag.

<tr>
   <td>
     <input type="checkbox" />
   </td>
   <td>
     <span> newCypressTestCore </span>
   </td>
</tr>






Aucun commentaire:

Enregistrer un commentaire