Bug 183284

Summary: Automation: clicking on a disabled option element shouldn't produce an error
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebDriverAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, ews-watchlist, mcatanzaro, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
bburg: review+, bburg: commit-queue-
Archive of layout-test-results from ews206 for win-future none

Description Carlos Garcia Campos 2018-03-02 03:14:17 PST
This was expected by selenium, but the WebDriver spec says we should simply do nothing in those cases. This makes test imported/w3c/webdriver/tests/element_click/select.py::test_option_disabled to fail.


session = <webdriver.client.Session object at 0x7f6f8dfc7ad0>

    def test_option_disabled(session):
        session.url = inline("""
            <select>
              <option disabled>foo
              <option>bar
            </select>""")
        option = session.find.css("option", all=False)
        assert not option.selected
    
>       option.click()

option     = <webdriver.client.Element object at 0x7f6f8c190b90>
session    = <webdriver.client.Session object at 0x7f6f8dfc7ad0>

WebDriverTests/imported/w3c/webdriver/tests/element_click/select.py:225: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
WebDriverTests/imported/w3c/tools/webdriver/webdriver/client.py:25: in inner
    return func(self, *args, **kwargs)
WebDriverTests/imported/w3c/tools/webdriver/webdriver/client.py:659: in click
    self.send_element_command("POST", "click", {})
WebDriverTests/imported/w3c/tools/webdriver/webdriver/client.py:649: in send_element_command
    return self.session.send_session_command(method, url, body)
WebDriverTests/imported/w3c/tools/webdriver/webdriver/client.py:480: in send_session_command
    return self.send_command(method, url, body)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <webdriver.client.Session object at 0x7f6f8dfc7ad0>, method = 'POST', url = 'session/44ec919a-0f09-4b58-89fe-8b40d790c639/element/node-C12D1824-176A-4750-8493-871BC6C8E9B5/click'
body = {}

    def send_command(self, method, url, body=None):
        """
            Send a command to the remote end and validate its success.
    
            :param method: HTTP method to use in request.
            :param uri: "Command part" of the HTTP request URL,
                e.g. `window/rect`.
            :param body: Optional body of the HTTP request.
    
            :return: `None` if the HTTP response body was empty, otherwise
                the `value` field returned after parsing the response
                body as JSON.
    
            :raises ValueError: If the response body does not contain a
                `value` key.
            :raises error.WebDriverException: If the remote end returns
                an error.
            """
        response = self.transport.send(
            method, url, body,
            encoder=protocol.Encoder, decoder=protocol.Decoder,
            session=self)
    
        if response.status != 200:
>           raise error.from_response(response)
E           ElementNotSelectableException: element not selectable (400):

body       = {}
method     = 'POST'
response   = <Response status=400 error=<ElementNotSelectableException http_status=400>>
self       = <webdriver.client.Session object at 0x7f6f8dfc7ad0>
url        = 'session/44ec919a-0f09-4b58-89fe-8b40d790c639/element/node-C12D1824-176A-4750-8493-871BC6C8E9B5/click'

WebDriverTests/imported/w3c/tools/webdriver/webdriver/client.py:439: ElementNotSelectableException
Comment 1 Carlos Garcia Campos 2018-03-02 03:18:01 PST
Created attachment 334890 [details]
Patch
Comment 2 Carlos Garcia Campos 2018-03-02 03:21:03 PST
This will break 3 selenium tests. I've fixed them in https://github.com/SeleniumHQ/selenium/pull/5561 I'll update selenium tests once the PR is fixed.
Comment 3 EWS Watchlist 2018-03-02 05:18:52 PST
Comment on attachment 334890 [details]
Patch

Attachment 334890 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/6733029

New failing tests:
http/tests/preload/download_resources.html
Comment 4 EWS Watchlist 2018-03-02 05:19:03 PST
Created attachment 334893 [details]
Archive of layout-test-results from ews206 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews206  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 5 BJ Burg 2018-03-02 10:39:21 PST
Comment on attachment 334890 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=334890&action=review

Great catch, r=me

I will be stepping up conformance fixes in the next month or two.

> Source/WebKit/ChangeLog:9
> +

Might be useful to link the spec here.

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

ยง14.1 Step 7-6 in the latest draft.
Comment 6 Carlos Garcia Campos 2018-03-05 00:34:09 PST
Committed r229212: <https://trac.webkit.org/changeset/229212>
Comment 7 Radar WebKit Bug Importer 2018-03-05 00:36:03 PST
<rdar://problem/38132550>