Skip to content

Commit 6e4f7c5

Browse files
DavertMikclaude
andcommitted
fix: use Array.from() for WebDriver element collections in selectElement
WebDriver returns element collections that aren't plain arrays, so .map() may not work correctly. Matches the pattern used in WebDriver's own assertOnlyOneElement. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c3097db commit 6e4f7c5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/helper/extras/elementSelection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function selectElement(els, locator, helper) {
4646

4747
if (isStrictStep(opts, helper)) {
4848
if (els.length > 1) {
49-
const webElements = els.map(el => new WebElement(el, helper))
49+
const webElements = Array.from(els).map(el => new WebElement(el, helper))
5050
throw new MultipleElementsFound(locator, webElements)
5151
}
5252
}

0 commit comments

Comments
 (0)