Skip to content

Commit 555abbd

Browse files
author
David Haeffner
committed
Updates to the xpath locator strategy for link text
1 parent 8b57015 commit 555abbd

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

packages/selenium-ide/src/content/locatorBuilders.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,13 @@ LocatorBuilders.add('xpath:innerText', function(el) {
496496
initialXpath,
497497
document,
498498
null,
499-
XPathResult.FIRST_ORDERED_NODE_TYPE,
499+
XPathResult.ORDERED_NODE_ITERATOR_TYPE,
500500
null
501-
).singleNodeValue
502-
if (xpathResults.includes(el)) {
503-
return xpathResults.length === 1
504-
? initialXpath
505-
: this.preciseXPath(initialXpath, el)
506-
} else {
507-
return null
501+
)
502+
let result = xpathResults.iterateNext()
503+
while (result) {
504+
if (result === el) break
505+
result = xpathResults.iterateNext()
508506
}
507+
return result ? this.preciseXPath(initialXpath, el) : null
509508
})

0 commit comments

Comments
 (0)