Get Element Property should JSON serialise its response value

NEW
Unassigned

Status

enhancement
P3
normal
a month ago
27 days ago

People

(Reporter: surkov, Unassigned)

Tracking

(Blocks 2 bugs)

Version 3
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 2 obsolete attachments)

Reporter

Description

a month ago

all find_element strategies don't work on shadow DOM, marionette had some initial shadowDOM support [1] in design but it seems not implemented [2]. It appears current way to deal with shadow DOM testing is executing a script [3]. So it might be a good working alternative to extend find_element to specify a property to call.

[1] https://searchfox.org/mozilla-central/source/testing/marionette/element.js#279
[2] https://searchfox.org/mozilla-central/source/testing/marionette/driver.js#2009
[3] https://searchfox.org/mozilla-central/source/testing/marionette/harness/marionette_harness/tests/unit/test_shadow_dom.py

Blocks: webdriver
Type: defect → enhancement
Priority: -- → P3
Summary: extend marionette find_element to call a property → Get Element Property should JSON serialise its response value

I looked into why evaluate.toJSON(els[name], seenEls) in listener.js
didn’t work as asurkov reported in
https://phabricator.services.mozilla.com/D27918#816998, and my
suspicion was correct, that Get Element Property fails to operate
on the document as mutated by Execute Script. I’ve filed
https://bugzilla.mozilla.org/show_bug.cgi?id=1546319 to write some
more detailed tests for this.

Depends on: 1546319

A WPT tests that exemplifies the issue:

def test_element(session):
    session.url = inline("""
        <p>foo
        <p>bar

        <script>
        const [foo, bar] = document.querySelectorAll("p");
        foo.bar = bar;
        </script>
        """)
    [foo, bar] = session.find.css("p")

    response = get_element_property(session, foo.id, "bar")
    value = assert_success(response)
    assert_same_element(session, value, bar)

Here we would expect the returned value to be a web element equal to bar.

Nothing remarkable in this patch.

There are approximately zero coverage for properties modified or set
by web content and through script evaluation. The only succcess
path test for Get Element Property is test_element, but it checks
an attribute already present in the prototype of the HTMLInputElement.

This patch adds tests where the property is defined through web
content. This uncovers a defect in Firefox, where Get Element
Property seemingly operates on the initial value of the attribute.

Attachment #9060046 - Attachment is obsolete: true
Attachment #9060047 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.