lib/webrat/selenium/location_strategy_javascript/webratlink.js in webrat-0.4.4 vs lib/webrat/selenium/location_strategy_javascript/webratlink.js in webrat-0.4.5
- old
+ new
@@ -1,7 +1,10 @@
var links = inDocument.getElementsByTagName('a');
var candidateLinks = $A(links).select(function(candidateLink) {
- return PatternMatcher.matches(locator, getText(candidateLink));
+ var textMatched = PatternMatcher.matches(locator, getText(candidateLink));
+ var idMatched = PatternMatcher.matches(locator, candidateLink.id);
+ var titleMatched = PatternMatcher.matches(locator, candidateLink.title);
+ return textMatched || idMatched || titleMatched;
});
if (candidateLinks.length == 0) {
return null;
}
candidateLinks = candidateLinks.sortBy(function(s) { return s.length * -1; }); //reverse length sort