| 221 | bot.locators.xpath.many = function (target, root) { |
| 222 | |
| 223 | function selectNodes() { |
| 224 | var result = bot.locators.xpath.evaluate_(root, target, |
| 225 | bot.locators.XPathResult_.ORDERED_NODE_SNAPSHOT_TYPE); |
| 226 | if (result) { |
| 227 | var count = result.snapshotLength; |
| 228 | var results = []; |
| 229 | for (var i = 0; i < count; ++i) { |
| 230 | results.push(result.snapshotItem(i)); |
| 231 | } |
| 232 | return results; |
| 233 | } else if (root.selectNodes) { |
| 234 | var doc = goog.dom.getOwnerDocument(root); |
| 235 | if (doc.setProperty) { |
| 236 | doc.setProperty('SelectionLanguage', 'XPath'); |
| 237 | } |
| 238 | return root.selectNodes(target); |
| 239 | } |
| 240 | return []; |
| 241 | } |
| 242 | |
| 243 | var nodes = selectNodes(); |
| 244 | goog.array.forEach(nodes, function (n) { |