, , , ,

Geckodriver 0.33.0 Released

Posted by

We are proud to announce the next major release of geckodriver 0.33.0. It ships with some new features that have been often requested by the WebDriver community, and as such brings geckodriver closer to the full WebDriver classic compatibility.

New Features

Support for “Get Computed Label” and “Get Computed Role”

To help various developers who are working on accessibility tests, and also our own colleagues at Mozilla who are improving accessibility APIs within Gecko (eg. as part of the Interop 2023 work) two APIs from the WebDriver classic specification have been implemented.

The command <em>Get Computed Label</em> returns the accessibility label (sometimes
also referred to as Accessible Name), which is a short string that labels the
function of the control (e.g. the string “Comment” or “Sign In” on a button).

Example that shows how to retrieve the accessibility label for an element on a web page:

def test_get_computed_label(session, inline):
    session.url = inline('<button aria-label="sign-in">Sign In</button>')
    element = session.find.css('button', all=False)
    assert_success(element.computed_label, 'sign-in')

The command <a href="https://w3c.github.io/webdriver/#get-computed-role"><em>Get Computed Role</em></a> returns the reserved token value (in ARIA,
button, heading, etc.) that describes the type of control or content in the
element.

Example that shows how to retrieve the accessibility label for an element on a web page:

def test_computed_role(session, inline):
    session.url = inline('<input role="searchbox">')
    element = session.find.css('input', all=False)
    assert_success(element.computed_role, 'searchbox')

Please note that for both APIs the minimum required Firefox version is 113.0, which currently is on the Beta Channel.

Support for “Find Element From Shadow Root” and “Find Elements From Shadow Root”

The commands allow a lookup of individual elements or collections of elements
within an open or even closed Shadow DOM. All location strategies except <em>Tag name</em> and
<em>XPath selector</em> are currently supported.

Example that shows how to retrieve an input element that is part of a custom element’s Shadow DOM, and afterward simulating a key input by a user:

def test_find_elements(session, inline):
    session.url = inline('<custom-element>')  # Shadow DOM with input element
    custom_el = session.find.css('custom-element', all=False)
    input_el = custom_el.shadow_root.find.css('input', all=False)
    input_el.send_keys('foo')

Note that the minimum required Firefox version is 113.0 for both APIs.

Changes

  • We have deprecated the usage of the <em><a href="https://firefox-source-docs.mozilla.org/testing/geckodriver/Capabilities.html#moz-usenonspeccompliantpointerorigin">moz:useNonSpecCompliantPointerOrigin</a></em> capability. This boolean capability was used to indicate how the pointer origin for an action command will be calculated. If enabled the offset position was determined by the top-left corner of the given element origin instead of it’s in-view center point.

    If any of your code relies on this particular Firefox only capability set to True it needs to be adjusted to work with the capability’s value set to False or removed.

    The removal of the capability will happen with Firefox 116, which means the next Firefox 115 ESR release will still support it for another year while getting security updates.

Downloads

As usual links to the pre-compiled binaries for popular platforms and the source code is available on the GitHub repository.

Leave a Reply

Your email address will not be published. Required fields are marked *