From 4daf0371465357036078caf123666697e6fa3622 Mon Sep 17 00:00:00 2001 From: Thomas Jack Date: Tue, 2 Jun 2009 18:31:33 -0500 Subject: [PATCH] make label location strategy work with unescaped strings --- lib/webrat/selenium/location_strategy_javascript/label.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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;