MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / selectSingleNode

Function selectSingleNode

javascript/atoms/locators/xpath.js:189–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187bot.locators.xpath.single = function (target, root) {
188
189 function selectSingleNode() {
190 var result = bot.locators.xpath.evaluate_(root, target,
191 bot.locators.XPathResult_.FIRST_ORDERED_NODE_TYPE);
192
193 if (result) {
194 var node = result.singleNodeValue;
195 return node || null;
196 } else if (root.selectSingleNode) {
197 var doc = goog.dom.getOwnerDocument(root);
198 if (doc.setProperty) {
199 doc.setProperty('SelectionLanguage', 'XPath');
200 }
201 return root.selectSingleNode(target);
202 }
203 return null;
204 }
205
206 var node = selectSingleNode();
207 if (node !== null) {

Callers 1

xpath.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected