cuprite
cuprite copied to clipboard
Cuprite finding elements inside closed detail tags
I'm in the process of replacing selenium with cuprite for my Rails system tests. I have a green CI with selenium, but when I switch to cuprite I start getting a lot of errors like this:
Test:
within ".modal-body-confirmation" do
click_button "Yes, delete"
end
Message
Capybara::Ambiguous: Ambiguous match, found 3 elements matching visible css ".modal-body-confirmation"
After checking, I discovered that I had 3 .modal-body-confirmation
elements inside 3 different detail
tags, but only 1 of those tags was open. So it seems that this file used for the specs needs to be updated to include a test for closed detail tags.
This is an extraction of what the HTML looked like at the failure. You can see 2 modal-body-confirmation but only whose parent detail element is open.
<details open="">
<summary class="modal-trigger">
<button class="" title="Recomeçar lista de presentes"><span>Recomeçar lista de presentes</span></button>
</summary>
<div class="modal-content pos-1001">
<div class="modal-body modal-body-confirmation">
<!-- Redacted -->
</div>
</div>
</details>
<details>
<summary class="modal-trigger">
<div class="" title="Remover loja"><span>Remover loja</span></div>
</summary>
<div class="modal-content pos-1001">
<div class="modal-body modal-body-confirmation">
<!-- Redacted -->
</div>
</div>
</details>