-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
Hi,
I am trying to select an option in my select2 that is inside an optgroup.
The error in capybara I get is:
Ambiguous match, found 2 elements matching css ".select2-dropdown li.select2-results__option" with text "Käpt’n Blaubär? (m)"
I called select2 like so:
select2 'Käpt’n Blaubär? (m)', css: '.select2-container'
My select2 with dummy data looks like this:
I suspect the ambiguity is caused by the fact that optgroups also have a 'select2-results__option' class:
<li aria-label="Boten" role="group" class="select2-results__option"><strong class="select2-results__group">Boten</strong>
<ul class="select2-results__options select2-results__options--nested">
<li aria-selected="false" role="treeitem" id="select2-name_of_my_select-result-hfih-4" class="select2-results__option select2-results__option--highlighted">Käpt’n Blaubär? (m)</li>
</ul>
</li>So there are 2 elements that contain the text 'Käpt’n Blaubär? (m)', the group 'Boten' and the item itself.
A fix would be to add the role attribute into the selection for items [role=treeitem]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
