| 187 | bot.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) { |