click_button in selenium works now same as in headless mode
This commit is contained in:
parent
6fc6530a6b
commit
73dc59cc29
|
@ -1,12 +1,19 @@
|
|||
if (locator == '*') {
|
||||
return selenium.browserbot.locationStrategies['xpath'].call(this, "//input[@type='submit']", inDocument, inWindow)
|
||||
}
|
||||
var buttons = inDocument.getElementsByTagName('button');
|
||||
var inputs = inDocument.getElementsByTagName('input');
|
||||
return $A(inputs).find(function(candidate){
|
||||
inputType = candidate.getAttribute('type');
|
||||
if (inputType == 'submit' || inputType == 'image') {
|
||||
var buttonText = $F(candidate);
|
||||
return (PatternMatcher.matches(locator, buttonText));
|
||||
var result = $A(inputs).concat($A(buttons)).find(function(candidate){
|
||||
var type = candidate.getAttribute('type');
|
||||
if (type == 'submit' || type == 'image' || type == 'button') {
|
||||
var matches_id = PatternMatcher.matches(locator, candidate.id);
|
||||
var matches_value = PatternMatcher.matches(locator, candidate.value);
|
||||
var matches_html = PatternMatcher.matches(locator, candidate.innerHTML);
|
||||
var matches_alt = PatternMatcher.matches(locator, candidate.alt);
|
||||
if (matches_id || matches_value || matches_html || matches_alt) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return result;
|
||||
|
|
Loading…
Reference in New Issue