Skip to content

Commit 04afbc4

Browse files
committed
Marking elements with 'pointer-events' style of 'none' as obscured in IE
1 parent acb5315 commit 04afbc4

File tree

5 files changed

+39
-8
lines changed

5 files changed

+39
-8
lines changed

cpp/iedriver/Element.cpp

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,36 @@ bool Element::IsObscured(LocationInfo* click_location,
246246
return false;
247247
}
248248

249-
bool is_obscured = false;
250249

251250
CComPtr<IHTMLDocument2> doc;
252251
this->GetContainingDocument(false, &doc);
253252

253+
// If an element has a style value where pointer-events is set to 'none',
254+
// the element is "obscured" by definition.
255+
CComPtr<IHTMLWindow2> window;
256+
hr = doc->get_parentWindow(&window);
257+
if (SUCCEEDED(hr) && window) {
258+
CComPtr<IHTMLWindow7> window7;
259+
hr = window->QueryInterface<IHTMLWindow7>(&window7);
260+
if (SUCCEEDED(hr) && window7) {
261+
CComPtr<IHTMLDOMNode> node;
262+
hr = this->element_->QueryInterface<IHTMLDOMNode>(&node);
263+
if (SUCCEEDED(hr) && node) {
264+
CComPtr<IHTMLCSSStyleDeclaration> computed_style;
265+
hr = window7->getComputedStyle(node, L"", &computed_style);
266+
if (SUCCEEDED(hr) && computed_style) {
267+
CComBSTR pointer_events_value = L"";
268+
hr = computed_style->get_pointerEvents(&pointer_events_value);
269+
if (SUCCEEDED(hr) && pointer_events_value == L"none") {
270+
return true;
271+
}
272+
}
273+
}
274+
}
275+
}
276+
277+
bool is_obscured = false;
278+
254279
std::vector<LocationInfo> frame_locations;
255280
LocationInfo element_location = {};
256281
int status_code = this->GetLocation(&element_location, &frame_locations);
@@ -588,7 +613,7 @@ int Element::GetLocationOnceScrolledIntoView(const ElementScrollBehavior scroll,
588613
bool Element::IsHiddenByOverflow() {
589614
LOG(TRACE) << "Entering Element::IsHiddenByOverflow";
590615

591-
bool isOverflow = false;
616+
bool is_overflow = false;
592617

593618
std::wstring script_source(L"(function() { return (");
594619
script_source += atoms::asString(atoms::IS_IN_PARENT_OVERFLOW);
@@ -602,12 +627,12 @@ bool Element::IsHiddenByOverflow() {
602627
if (status_code == WD_SUCCESS) {
603628
std::wstring raw_overflow_state(script_wrapper.result().bstrVal);
604629
std::string overflow_state = StringUtilities::ToString(raw_overflow_state);
605-
isOverflow = (overflow_state == "scroll");
630+
is_overflow = (overflow_state == "scroll");
606631
} else {
607632
LOG(WARN) << "Unable to determine is element hidden by overflow";
608633
}
609634

610-
return isOverflow;
635+
return is_overflow;
611636
}
612637

613638
bool Element::IsLocationVisibleInFrames(const LocationInfo location,

cpp/iedriverserver/CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ available via the project downloads page. Changes in "revision" field indicate
99
private releases checked into the prebuilts directory of the source tree, but
1010
not made generally available on the downloads page.
1111

12+
v3.12.0.5
13+
=========
14+
* Updating to indicate elements with 'pointer-events' style of 'none' as
15+
obscured, triggering "element click intercepted" error response. This is
16+
in keeping with the W3C WebDriver Specification that demands this behavior.
17+
1218
v3.12.0.4
1319
=========
1420
* Updates to JavaScript automation atoms.

cpp/iedriverserver/IEDriverServer.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ END
5050
//
5151

5252
VS_VERSION_INFO VERSIONINFO
53-
FILEVERSION 3,12,0,4
54-
PRODUCTVERSION 3,12,0,4
53+
FILEVERSION 3,12,0,5
54+
PRODUCTVERSION 3,12,0,5
5555
FILEFLAGSMASK 0x3fL
5656
#ifdef _DEBUG
5757
FILEFLAGS 0x1L
@@ -68,12 +68,12 @@ BEGIN
6868
BEGIN
6969
VALUE "CompanyName", "Software Freedom Conservancy"
7070
VALUE "FileDescription", "Command line server for the IE driver"
71-
VALUE "FileVersion", "3.12.0.4"
71+
VALUE "FileVersion", "3.12.0.5"
7272
VALUE "InternalName", "IEDriverServer.exe"
7373
VALUE "LegalCopyright", "Copyright (C) 2017"
7474
VALUE "OriginalFilename", "IEDriverServer.exe"
7575
VALUE "ProductName", "Selenium WebDriver"
76-
VALUE "ProductVersion", "3.12.0.4"
76+
VALUE "ProductVersion", "3.12.0.5"
7777
END
7878
END
7979
BLOCK "VarFileInfo"
0 Bytes
Binary file not shown.
1.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)