mardi 13 avril 2021

Cypress: Click a checkbox in a TD next to a td with specific text

Is this possible?

My table is like this:

[ ]           Address string 1
[ ]           Address string 2
...

The markup:

<td>
  <div>
    <input class="hb-checkbox type="checkbox" id="byggSkjemaliste-element0-0-adresse-skjema-element-0">
    <div class="hb-label" data-e2e-selector="byggSkjemaliste-element0-0-adresse-skjema-element-0hb-checkbox-label">
      <label for="byggSkjemaliste-element0-0-adresse-skjema-element-0" id="byggSkjemaliste-element0-0-adresse-skjema-element-0-label"></label>
    </div>
  </div>
</td>
<td>
  Address string"
</td>

A'd like to be able to find "Address string 1" in the table, then click the checkbox in the to the left of that

Since I don't have control over the complex dynamic selectors created, it's very complex to try and use those when the table gets bigger, and when there are multiple tables on the page. Also, I'd like a more elegant way to select the checkbox in a specific row.




Aucun commentaire:

Enregistrer un commentaire