Skip to content

Commit

Permalink
Merge r229212 - Automation: clicking on a disabled option element sho…
Browse files Browse the repository at this point in the history
…uldn't produce an error

https://bugs.webkit.org/show_bug.cgi?id=183284

Reviewed by Brian Burg.

This was expected by selenium, but the WebDriver spec says we should simply do nothing in those cases.

14.1 Element Click.
https://w3c.github.io/webdriver/webdriver-spec.html#element-click

Fixes: imported/w3c/webdriver/tests/element_click/select.py::test_option_disabled

* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::selectOptionElement):
  • Loading branch information
carlosgcampos committed Mar 5, 2018
1 parent 08f0e13 commit ddbbd7f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
17 changes: 17 additions & 0 deletions Source/WebKit/ChangeLog
@@ -1,3 +1,20 @@
2018-03-05 Carlos Garcia Campos <cgarcia@igalia.com>

Automation: clicking on a disabled option element shouldn't produce an error
https://bugs.webkit.org/show_bug.cgi?id=183284

Reviewed by Brian Burg.

This was expected by selenium, but the WebDriver spec says we should simply do nothing in those cases.

14.1 Element Click.
https://w3c.github.io/webdriver/webdriver-spec.html#element-click

Fixes: imported/w3c/webdriver/tests/element_click/select.py::test_option_disabled

* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::selectOptionElement):

2018-03-05 Carlos Garcia Campos <cgarcia@igalia.com>

Automation: stale elements not detected when removed from the DOM
Expand Down
Expand Up @@ -650,15 +650,11 @@ void WebAutomationSessionProxy::selectOptionElement(uint64_t pageID, uint64_t fr
return;
}

if (selectElement->isDisabledFormControl() || optionElement.isDisabledFormControl()) {
String elementNotSelectableErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::ElementNotSelectable);
WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidSelectOptionElement(callbackID, elementNotSelectableErrorType), 0);
return;
if (!selectElement->isDisabledFormControl() && !optionElement.isDisabledFormControl()) {
// FIXME: According to the spec we should fire mouse over, move and down events, then input and change, and finally mouse up and click.
// optionSelectedByUser() will fire input and change events if needed, but all other events should be fired manually here.
selectElement->optionSelectedByUser(optionElement.index(), true, selectElement->multiple());
}

// FIXME: According to the spec we should fire mouse over, move and down events, then input and change, and finally mouse up and click.
// optionSelectedByUser() will fire input and change events if needed, but all other events should be fired manually here.
selectElement->optionSelectedByUser(optionElement.index(), true, selectElement->multiple());
WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidSelectOptionElement(callbackID, { }), 0);
}

Expand Down

0 comments on commit ddbbd7f

Please sign in to comment.