Make link location in Selenium more reliable and consistent with non-Selenium
This commit is contained in:
parent
b51ba029db
commit
03f2023117
@ -1,9 +1,21 @@
|
|||||||
var links = inDocument.getElementsByTagName('a');
|
var links = inDocument.getElementsByTagName('a');
|
||||||
|
|
||||||
var candidateLinks = $A(links).select(function(candidateLink) {
|
var candidateLinks = $A(links).select(function(candidateLink) {
|
||||||
var textMatched = PatternMatcher.matches(locator, getText(candidateLink));
|
var textMatched = false;
|
||||||
var idMatched = PatternMatcher.matches(locator, candidateLink.id);
|
var titleMatched = false;
|
||||||
var titleMatched = PatternMatcher.matches(locator, candidateLink.title);
|
var idMatched = false;
|
||||||
|
|
||||||
|
if (getText(candidateLink).toLowerCase().indexOf(locator.toLowerCase()) != -1) {
|
||||||
|
textMatched = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (candidateLink.title.toLowerCase().indexOf(locator.toLowerCase()) != -1) {
|
||||||
|
titleMatched = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (candidateLink.id.toLowerCase().indexOf(locator.toLowerCase()) != -1) {
|
||||||
|
idMatched = true;
|
||||||
|
}
|
||||||
|
|
||||||
return textMatched || idMatched || titleMatched;
|
return textMatched || idMatched || titleMatched;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user