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 SeleniumHQ#503.
1 parent 1eaa4d9 commit 698dc42

File tree

9 files changed

+13
-7
lines changed

9 files changed

+13
-7
lines changed

cpp/iedriver/CommandHandlers/ClickElementCommandHandler.h

Lines changed: 1 addition & 1 deletion
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;

cpp/iedriver/CommandHandlers/IsElementDisplayedCommandHandler.h

Lines changed: 1 addition & 1 deletion
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 {

cpp/iedriver/CommandHandlers/SendKeysCommandHandler.h

Lines changed: 1 addition & 1 deletion
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");

cpp/iedriver/Element.cpp

Lines changed: 3 additions & 3 deletions
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;

cpp/iedriver/Element.h

Lines changed: 1 addition & 1 deletion
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);

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+
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.

cpp/iedriverserver/IEDriverServer.rc

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy