Use elementFromPoint for IE driver in determining obscured elements
This is in direct violation of the algorithm specified in the W3C
WebDriver Specification, but it fixes a class of IE-specific bugs that
present themselves when using elementsFromPoint. This is used to shortcut
the use of elementsFromPoint if it is not necessary.
@@ -280,6 +280,14 @@ bool Element::IsObscured(LocationInfo* click_location,
y = top + (height / 2);
}
+ CComPtr<IHTMLElement> element_hit;
+ hr = doc->elementFromPoint(x, y, &element_hit);
+ if (SUCCEEDED(hr) && element_.IsEqualObject(element_hit)) {
+ // Short circuit the use of elementsFromPoint if we don't
+ // have to use it.
+ return false;
+ }
+
CComPtr<IHTMLDocument8> elements_doc;
hr = doc.QueryInterface<IHTMLDocument8>(&elements_doc);
if (FAILED(hr)) {
