Skip to content

Commit

Permalink
Revert "make label location strategy work with unescaped strings"
Browse files Browse the repository at this point in the history
This reverts commit 4daf037.

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>
  • Loading branch information
brynary committed Jun 15, 2009
1 parent b4ae28c commit 9a42304
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/webrat/selenium/location_strategy_javascript/label.js
@@ -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;
Expand Down

1 comment on commit 9a42304

@jonathan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change actually breaks all my selenium tests where I'm searching for a label.
fill_in("Name:", :with => name) now fails but
fill_in("student_name", :with => name) works (basically using the id of the textfield still works).

Please sign in to comment.