mardi 31 mai 2022

Selenium (Java) and seemingly unsolvable "element not interactable"

I've run into a Selenium element not interactable problem that I cannot seem to solve. The page is an Angular page, if that's relevant. The element is a checkbox, with a label (among other things).

The markup in question (of course, part of a larger page - and I've removed some irrelevant styling data etc.):

<div class="hb-grid hb-grid--gapSM">
 <div data-e2e-selector="saksjournal-checkbox-style" style="visibility: visible;">
  <input type="checkbox" data-e2e-selector="saksjournal-checkbox" id="erArkivert-0">
   <div class="hb-label">
    <label data-e2e-selector="saksjournal-checkbox-lbl" for="erArkivert-0" aria-describedby="journalPostArkiverStatus-0"></label>
   </div>
  </div>
  <div class="hb-cell" id="journalPostArkiverStatus-0">
   <div class="haster ng-star-inserted">
    <div class="ng-star-inserted">Ikke arkivert</div>
    <div class="ng-star-inserted">
     <a href="#" id="lastNedArkivStatus2" class="hb-tekst--s">Last ned journalpost</a> og kryss av når du har arkivert manuelt 
    </div>
   </div>
  </div>
 </div>

After simplyfying the Java/Selenium code for troubleshooting, this is what I've tried to be able to click the checkbox:

driver.findElement(By.cssSelector("label[for='erArkivert-0']")).click();

and

driver.findElement(By.cssSelector("[data-e2e-selector='saksjournal-checkbox-lbl']")).click();

and

driver.findElement(By.cssSelector("[data-e2e-selector='saksjournal-checkbox']")).click();

Also, of course, the ID for the last element (which shouldn't make any difference).

All these result in "element not interactable". Before, I used to be able to work around this thing by doing exactly what I'm doing above - clicking the instead of the checkbox element. But this doesn't work anymore.

Any ideas?




Aucun commentaire:

Enregistrer un commentaire