Skip to content

Commit 698dc42

Browse files
committed
Changing IE driver to allow interaction with elements where opacity = 0
The isDisplayed will still return false for those elements, as is consistent with drivers for Firefox and Chrome. Fixes issue #503.
1 parent 1eaa4d9 commit 698dc42

File tree

9 files changed

+13
-7
lines changed

9 files changed

+13
-7
lines changed

Diff for: cpp/iedriver/CommandHandlers/ClickElementCommandHandler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class ClickElementCommandHandler : public IECommandHandler {
108108
}
109109
} else {
110110
bool displayed;
111-
status_code = element_wrapper->IsDisplayed(&displayed);
111+
status_code = element_wrapper->IsDisplayed(true, &displayed);
112112
if (status_code != WD_SUCCESS) {
113113
response->SetErrorResponse(status_code, "Unable to determine element is displayed");
114114
return;

Diff for: cpp/iedriver/CommandHandlers/IsElementDisplayedCommandHandler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class IsElementDisplayedCommandHandler : public IECommandHandler {
5353
status_code = this->GetElement(executor, element_id, &element_wrapper);
5454
if (status_code == WD_SUCCESS) {
5555
bool result;
56-
status_code = element_wrapper->IsDisplayed(&result);
56+
status_code = element_wrapper->IsDisplayed(false, &result);
5757
if (status_code == WD_SUCCESS) {
5858
response->SetSuccessResponse(result);
5959
} else {

Diff for: cpp/iedriver/CommandHandlers/SendKeysCommandHandler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class SendKeysCommandHandler : public IECommandHandler {
8181

8282
if (status_code == WD_SUCCESS) {
8383
bool displayed;
84-
status_code = element_wrapper->IsDisplayed(&displayed);
84+
status_code = element_wrapper->IsDisplayed(true, &displayed);
8585
if (status_code != WD_SUCCESS || !displayed) {
8686
response->SetErrorResponse(EELEMENTNOTDISPLAYED,
8787
"Element is not displayed");

Diff for: cpp/iedriver/Element.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Json::Value Element::ConvertToJson() {
8383
return json_wrapper;
8484
}
8585

86-
int Element::IsDisplayed(bool* result) {
86+
int Element::IsDisplayed(bool ignore_opacity, bool* result) {
8787
LOG(TRACE) << "Entering Element::IsDisplayed";
8888

8989
int status_code = WD_SUCCESS;
@@ -100,7 +100,7 @@ int Element::IsDisplayed(bool* result) {
100100
// N.B., The second argument to the IsDisplayed atom is "ignoreOpacity".
101101
Script script_wrapper(doc, script_source, 2);
102102
script_wrapper.AddArgument(this->element_);
103-
script_wrapper.AddArgument(false);
103+
script_wrapper.AddArgument(ignore_opacity);
104104
status_code = script_wrapper.Execute();
105105

106106
if (status_code == WD_SUCCESS) {
@@ -214,7 +214,7 @@ int Element::GetClickLocation(const ELEMENT_SCROLL_BEHAVIOR scroll_behavior,
214214
LOG(TRACE) << "Entering Element::GetClickLocation";
215215

216216
bool displayed;
217-
int status_code = this->IsDisplayed(&displayed);
217+
int status_code = this->IsDisplayed(true, &displayed);
218218
if (status_code != WD_SUCCESS) {
219219
LOG(WARN) << "Unable to determine element is displayed";
220220
return status_code;

Diff for: cpp/iedriver/Element.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Element {
6060
int GetCssPropertyValue(const std::string& property_name,
6161
std::string* property_value);
6262

63-
int IsDisplayed(bool* result);
63+
int IsDisplayed(bool ignore_opacity, bool* result);
6464
bool IsEnabled(void);
6565
bool IsSelected(void);
6666
bool IsInteractable(void);

Diff for: cpp/iedriverserver/CHANGELOG

+6
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+
v2.45.0.5
13+
=========
14+
* Changed to allow interaction with elements where opacity = 0. The
15+
isDisplayed will still return false for those elements, as is consistent
16+
with drivers for Firefox and Chrome. Fixes issue #503.
17+
1218
v2.45.0.4
1319
=========
1420
* Added busy check after attaching to newly launched IE instance.

Diff for: cpp/iedriverserver/IEDriverServer.rc

0 Bytes
Binary file not shown.

Diff for: cpp/prebuilt/Win32/Release/IEDriverServer.exe

0 Bytes
Binary file not shown.

Diff for: cpp/prebuilt/x64/Release/IEDriverServer.exe

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)