Sha256: d26d001345ff2e1235d3d525b0d8267c1bb0046687a03285798ded08958b12c1
Contents?: true
Size: 785 Bytes
Versions: 91
Compression:
Stored size: 785 Bytes
Contents
var allLabels = inDocument.getElementsByTagName("label"); var candidateLabels = $A(allLabels).select(function(candidateLabel){ var regExp = new RegExp('^' + locator + '\\b', 'i'); var labelText = getText(candidateLabel).strip(); return (labelText.search(regExp) >= 0); }); if (candidateLabels.length == 0) { return null; } candidateLabels = candidateLabels.sortBy(function(s) { return s.length * -1; }); //reverse length sort var locatedLabel = candidateLabels.first(); var labelFor = locatedLabel.getAttribute('for'); if ((labelFor == null) && (locatedLabel.hasChildNodes())) { return locatedLabel.firstChild; //TODO: should find the first form field, not just any node } return selenium.browserbot.locationStrategies['id'].call(this, labelFor, inDocument, inWindow);
Version data entries
91 entries across 91 versions & 28 rubygems