Revert "make label location strategy work with unescaped strings"

This reverts commit 4daf037146.

This was causing failures in the Weplay selenium suite, where we
we're using partial matches. For example:

  fill_in "Write a message", ...

When the markup was:

  <label>Write a message to Bryan ...</label>
This commit is contained in:
Bryan Helmkamp 2009-06-15 17:59:13 -04:00
parent b4ae28c48c
commit 9a42304513
1 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,8 @@
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.toLowerCase() == locator.toLowerCase();
return (labelText.search(regExp) >= 0);
});
if (candidateLabels.length == 0) {
return null;