Skip to content

Commit 839f73a

Browse files
p0dejebarancev
authored andcommitted
firefox: Check that select is clickable when clicking option
Signed-off-by: Alexei Barantsev <barancev@gmail.com>
1 parent 5664d8a commit 839f73a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

javascript/firefox-driver/js/syntheticMouse.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ SyntheticMouse.prototype.isElementShown = function(element) {
9999

100100

101101
SyntheticMouse.prototype.isElementClickable = function(element) {
102+
// Check to see if this is an option element. If it is, and the parent isn't a multiple
103+
// select, then check that select is clickable.
104+
var tagName = element.tagName.toLowerCase();
105+
if ('option' == tagName) {
106+
var parent = element;
107+
while (parent.parentNode != null && parent.tagName.toLowerCase() != 'select') {
108+
parent = parent.parentNode;
109+
}
110+
111+
if (parent && parent.tagName.toLowerCase() == 'select' && !parent.multiple) {
112+
return this.isElementClickable(parent);
113+
}
114+
}
115+
102116
// get the outermost ancestor of the element. This will be either the document
103117
// or a shadow root.
104118
var owner = element;

0 commit comments

Comments
 (0)