diff --git a/lib/webrat/selenium/location_strategy_javascript/label.js b/lib/webrat/selenium/location_strategy_javascript/label.js index b5acd10..700e14a 100644 --- a/lib/webrat/selenium/location_strategy_javascript/label.js +++ b/lib/webrat/selenium/location_strategy_javascript/label.js @@ -1,8 +1,7 @@ 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); + return labelText.toLowerCase() == locator.toLowerCase(); }); if (candidateLabels.length == 0) { return null;