Skip to content

Commit 9c0ca98

Browse files
committed
Updating clear element command handler to return W3C compliant errors for IE
1 parent c6a2b9a commit 9c0ca98

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

cpp/iedriver/CommandHandlers/ClearElementCommandHandler.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,17 @@ void ClearElementCommandHandler::ExecuteInternal(
5656
// does not return the proper error code when this error condition is encountered.
5757
// Thus, we'll check the interactable and editable states of the element before
5858
// attempting to clear it.
59-
if (!element_wrapper->IsInteractable() || !element_wrapper->IsEditable()) {
60-
response->SetErrorResponse(EELEMENTNOTENABLED,
61-
"Element must not be hidden, disabled or read-only");
59+
if (!element_wrapper->IsEditable() || !element_wrapper->IsEnabled()) {
60+
response->SetErrorResponse(ERROR_INVALID_ELEMENT_STATE,
61+
"Element must not be read-only or disabled");
62+
return;
63+
}
64+
if (!element_wrapper->IsInteractable()) {
65+
response->SetErrorResponse(ERROR_ELEMENT_NOT_INTERACTABLE,
66+
"Element is not interactable, it must not be hidden and it must be able to receive focus");
6267
return;
6368
}
69+
6470
// The atom is just the definition of an anonymous
6571
// function: "function() {...}"; Wrap it in another function so we can
6672
// invoke it with our arguments without polluting the current namespace.

0 commit comments

Comments
 (0)