Bug 180413 - WebDriver: differentiate between no suh element and stale element errors
Summary: WebDriver: differentiate between no suh element and stale element errors
Status: RESOLVED DUPLICATE of bug 204684
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-05 03:19 PST by Carlos Garcia Campos
Modified: 2020-01-08 03:18 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2017-12-05 03:19:52 PST
Currently we always fail with stale element error when we fail to find a node. There are two options in the spec: get a known element and get a known connected element:


To get a known element with argument reference, run the following steps:

 1. Let element be the item in the current browsing context's list of known elements for which the web element reference matches reference, if such an element exists. Otherwise return error with error code no such element.
 2. If element is stale, return error with error code stale element reference.
Return success with element.

To get a known connected element with argument reference, run the following steps:

 1. Let element be the result of trying to get a known element with argument reference.
 2. If element is not connected return error with error code stale element reference.
 3. Return success with element.

This is causing several tests to fail:

imported/w3c/webdriver/tests/state/get_element_property.py::test_element_not_found
imported/w3c/webdriver/tests/state/get_element_attribute.py::test_element_not_found
imported/w3c/webdriver/tests/state/get_element_tag_name.py::test_element_not_found

with similat backtrace in all the cases:

response = <Response status=404 error=<StaleElementReferenceException http_status=404>>, error_code = 'no such element'

    def assert_error(response, error_code):
        """
        Verify that the provided webdriver.Response instance described
        a valid error response as defined by `dfn-send-an-error` and
        the provided error code.
    
        :param response: ``webdriver.Response`` instance.
        :param error_code: String value of the expected error code
        """
        assert response.status == errors[error_code]
        assert "value" in response.body
>       assert response.body["value"]["error"] == error_code
E       AssertionError

error_code = 'no such element'
response   = <Response status=404 error=<StaleElementReferenceException http_status=404>>
Comment 1 Carlos Garcia Campos 2020-01-08 03:18:11 PST

*** This bug has been marked as a duplicate of bug 204684 ***