diff --git a/lib/webrat/selenium/location_strategy_javascript/label.js b/lib/webrat/selenium/location_strategy_javascript/label.js index dd137441..b5dc731e 100644 --- a/lib/webrat/selenium/location_strategy_javascript/label.js +++ b/lib/webrat/selenium/location_strategy_javascript/label.js @@ -21,7 +21,7 @@ var candidateLabels = $A(allLabels).select(function(candidateLabel){ }); if (candidateLabels.length == 0) { - return null; + return null; } //reverse length sort @@ -30,7 +30,7 @@ candidateLabels = candidateLabels.sortBy(function(s) { }); var locatedLabel = candidateLabels.first(); -var labelFor = locatedLabel.getAttribute('for'); +var labelFor = locatedLabel.getAttribute('for') || locatedLabel.htmlFor; if ((labelFor == null) && (locatedLabel.hasChildNodes())) { return locatedLabel.getElementsByTagName('button')[0]