Closed Bug 1544906 Opened 6 years ago Closed 2 years ago

Get Element Property should JSON serialise its response value

Categories

(Remote Protocol :: Marionette, enhancement, P3)

Version 3
enhancement

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1398792

People

(Reporter: surkov, Assigned: whimboo)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

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

The following patch is waiting for review from an inactive reviewer:

ID Title Author Reviewer Status
D27918 Bug 1544906 - marionette get_property fails to return a DOM node surkov ato: Resigned from review

:surkov, could you please find another reviewer or abandon the patch if it is no longer relevant?

For more information, please visit auto_nag documentation.

Flags: needinfo?(surkov.alexander)

This is basically the same as bug 1398792. We will have to waive XRays to actually access the property which exists in the scope of the page.

Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(surkov.alexander)
Resolution: --- → DUPLICATE
Assignee: nobody → hskupin
Attachment #9058993 - Attachment is obsolete: true
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: