vendredi 16 octobre 2020

Cypress Test: finds no element

i am trying to select this item from this list but it says it doesn't exist enter image description here

this is the html structure:

<span class="select2-results">
<ul class="select2-results__options" role="listbox" tabindex="-1" id="select2-billing_country-results" aria-expanded="true" aria-hidden="false" aria-activedescendant="select2-billing_country-result-jqjd-AS">
<li class="select2-results__option" id="select2-billing_country-result-klqe-default" role="option" data-selected="false" tabindex="-1" aria-selected="false">Seleziona un Paese/una regione…</li>
<li class="select2-results__option" id="select2-billing_country-result-gzkv-AX" role="option" data-selected="false" tabindex="-1" aria-selected="false">Åland Islands</li>
<li class="select2-results__option" id="select2-billing_country-result-n44m-AF" role="option" data-selected="true" tabindex="-1" aria-selected="false">Afghanistan</li>
......

with cypress I use these commands:

cy.get('#select2-billing_country-container').click()
cy.get('li#select2-billing_country-result-c98f-default').click()

but i get the following error:

enter image description here

Aucun commentaire:

Enregistrer un commentaire