[WebDriver] Implement "Find Element(s) From ShadowRoot" (#37578)

Also renamed all "CSS" selector variants of `WebDriverScriptCommand` to
avoid confusion.

Testing: Mostly `./mach test-wpt -r
tests\wpt\tests\webdriver\tests\classic\find_*_from_shadow_root\find.py
--product servodriver`
But many other test also relies on finding element(s) from shadow root,
so I ran the entire test.
All deleted lines are from test expectations.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
Euclid Ye 2025-06-20 19:54:39 +08:00 committed by GitHub
parent c9d503c458
commit ce4da2bf97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 237 additions and 315 deletions

View file

@ -1,6 +1,3 @@
[click.py]
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL

View file

@ -1,97 +1,10 @@
[find.py]
[test_null_parameter_value]
expected: FAIL
[test_no_top_browsing_context]
expected: FAIL
[test_no_browsing_context]
expected: FAIL
[test_no_such_shadow_root_with_element]
expected: FAIL
[test_no_such_shadow_root_with_unknown_shadow_root]
expected: FAIL
[test_no_such_shadow_root_with_shadow_root_from_other_window_handle]
expected: FAIL
[test_no_such_shadow_root_with_shadow_root_from_other_frame]
expected: FAIL
[test_detached_shadow_root[top_context\]]
expected: FAIL
[test_detached_shadow_root[child_context\]]
expected: FAIL
[test_no_such_element_with_unknown_selector[not-existent\]]
expected: FAIL
[test_no_such_element_with_unknown_selector[existent-other-frame\]]
expected: FAIL
[test_no_such_element_with_unknown_selector[existent-outside-shadow-root\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[True\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[None\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[1\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[shadow_root_id3\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[shadow_root_id4\]]
expected: FAIL
[test_invalid_using_argument[a\]]
expected: FAIL
[test_invalid_using_argument[True\]]
expected: FAIL
[test_invalid_using_argument[None\]]
expected: FAIL
[test_invalid_using_argument[1\]]
expected: FAIL
[test_invalid_using_argument[using4\]]
expected: FAIL
[test_invalid_using_argument[using5\]]
expected: FAIL
[test_invalid_selector_argument[None\]]
expected: FAIL
[test_invalid_selector_argument[value1\]]
expected: FAIL
[test_invalid_selector_argument[value2\]]
expected: FAIL
[test_found_element_equivalence]
expected: FAIL
[test_find_element[open-css selector-#linkText\]]
expected: FAIL
[test_find_element[open-link text-full link text\]]
expected: FAIL
[test_find_element[open-partial link text-link text\]]
expected: FAIL
[test_find_element[open-tag name-a\]]
expected: FAIL
[test_find_element[open-xpath-//a\]]
expected: FAIL
@ -110,47 +23,5 @@
[test_find_element[closed-xpath-//a\]]
expected: FAIL
[test_find_element_link_text[<a href=#>link text</a>-link text\]]
expected: FAIL
[test_find_element_link_text[<a href=#>&nbsp;link text&nbsp;</a>-link text\]]
expected: FAIL
[test_find_element_link_text[<a href=#>link<br>text</a>-link\\ntext\]]
expected: FAIL
[test_find_element_link_text[<a href=#>link&amp;text</a>-link&text\]]
expected: FAIL
[test_find_element_link_text[<a href=#>LINK TEXT</a>-LINK TEXT\]]
expected: FAIL
[test_find_element_link_text[<a href=# style='text-transform: uppercase'>link text</a>-LINK TEXT\]]
expected: FAIL
[test_find_element_partial_link_text[<a href=#>partial link text</a>-link\]]
expected: FAIL
[test_find_element_partial_link_text[<a href=#>&nbsp;partial link text&nbsp;</a>-link\]]
expected: FAIL
[test_find_element_partial_link_text[<a href=#>partial link text</a>-k t\]]
expected: FAIL
[test_find_element_partial_link_text[<a href=#>partial link<br>text</a>-k\\nt\]]
expected: FAIL
[test_find_element_partial_link_text[<a href=#>partial link&amp;text</a>-k&t\]]
expected: FAIL
[test_find_element_partial_link_text[<a href=#>PARTIAL LINK TEXT</a>-LINK\]]
expected: FAIL
[test_find_element_partial_link_text[<a href=# style='text-transform: uppercase'>partial link text</a>-LINK\]]
expected: FAIL
[test_find_element_in_nested_shadow_root[open\]]
expected: FAIL
[test_find_element_in_nested_shadow_root[closed\]]
expected: FAIL

View file

@ -1,97 +1,10 @@
[find.py]
[test_null_parameter_value]
expected: FAIL
[test_no_top_browsing_context]
expected: FAIL
[test_no_browsing_context]
expected: FAIL
[test_no_such_shadow_root_with_element]
expected: FAIL
[test_no_such_shadow_root_with_unknown_shadow_root]
expected: FAIL
[test_no_such_shadow_root_with_shadow_root_from_other_window_handle]
expected: FAIL
[test_no_such_shadow_root_with_shadow_root_from_other_frame]
expected: FAIL
[test_detached_shadow_root[top_context\]]
expected: FAIL
[test_detached_shadow_root[child_context\]]
expected: FAIL
[test_no_elements_with_unknown_selector[not-existent\]]
expected: FAIL
[test_no_elements_with_unknown_selector[existent-other-frame\]]
expected: FAIL
[test_no_elements_with_unknown_selector[existent-outside-shadow-root\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[True\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[None\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[1\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[shadow_root_id3\]]
expected: FAIL
[test_invalid_shadow_root_id_argument[shadow_root_id4\]]
expected: FAIL
[test_invalid_using_argument[a\]]
expected: FAIL
[test_invalid_using_argument[True\]]
expected: FAIL
[test_invalid_using_argument[None\]]
expected: FAIL
[test_invalid_using_argument[1\]]
expected: FAIL
[test_invalid_using_argument[using4\]]
expected: FAIL
[test_invalid_using_argument[using5\]]
expected: FAIL
[test_invalid_selector_argument[None\]]
expected: FAIL
[test_invalid_selector_argument[value1\]]
expected: FAIL
[test_invalid_selector_argument[value2\]]
expected: FAIL
[test_find_elements_equivalence]
expected: FAIL
[test_find_elements[open-css selector-#linkText\]]
expected: FAIL
[test_find_elements[open-link text-full link text\]]
expected: FAIL
[test_find_elements[open-partial link text-link text\]]
expected: FAIL
[test_find_elements[open-tag name-a\]]
expected: FAIL
[test_find_elements[open-xpath-//a\]]
expected: FAIL
@ -110,47 +23,5 @@
[test_find_elements[closed-xpath-//a\]]
expected: FAIL
[test_find_elements_link_text[<a href=#>link text</a>-link text\]]
expected: FAIL
[test_find_elements_link_text[<a href=#>&nbsp;link text&nbsp;</a>-link text\]]
expected: FAIL
[test_find_elements_link_text[<a href=#>link<br>text</a>-link\\ntext\]]
expected: FAIL
[test_find_elements_link_text[<a href=#>link&amp;text</a>-link&text\]]
expected: FAIL
[test_find_elements_link_text[<a href=#>LINK TEXT</a>-LINK TEXT\]]
expected: FAIL
[test_find_elements_link_text[<a href=# style='text-transform: uppercase'>link text</a>-LINK TEXT\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=#>partial link text</a>-link\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=#>&nbsp;partial link text&nbsp;</a>-link\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=#>partial link text</a>-k t\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=#>partial link<br>text</a>-k\\nt\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=#>partial link&amp;text</a>-k&t\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=#>PARTIAL LINK TEXT</a>-LINK\]]
expected: FAIL
[test_find_elements_partial_link_text[<a href=# style='text-transform: uppercase'>partial link text</a>-LINK\]]
expected: FAIL
[test_find_elements_in_nested_shadow_root[open\]]
expected: FAIL
[test_find_elements_in_nested_shadow_root[closed\]]
expected: FAIL

View file

@ -2,8 +2,5 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_computed_roles[<article>foo</article>-article-article\]]
expected: FAIL

View file

@ -2,9 +2,6 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_boolean_attribute[audio-attrs0\]]
expected: FAIL

View file

@ -1,6 +1,3 @@
[get.py]
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL

View file

@ -2,8 +2,5 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_web_reference[shadowRoot-ShadowRoot\]]
expected: FAIL

View file

@ -2,8 +2,5 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_basic]
expected: FAIL

View file

@ -2,8 +2,5 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_get_element_tag_name]
expected: FAIL

View file

@ -2,9 +2,6 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_shadow_root_slot[custom outside\]]
expected: FAIL

View file

@ -2,9 +2,6 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_stale_element_reference[child_context\]]
expected: FAIL

View file

@ -2,8 +2,5 @@
[test_no_browsing_context]
expected: FAIL
[test_no_such_element_with_shadow_root]
expected: FAIL
[test_stale_element_reference[child_context\]]
expected: FAIL

View file

@ -1,13 +1,7 @@
[wheel.py]
[test_scroll_shadow_tree[outer-open\]]
expected: FAIL
[test_scroll_shadow_tree[outer-closed\]]
expected: FAIL
[test_scroll_shadow_tree[inner-open\]]
expected: FAIL
[test_scroll_shadow_tree[inner-closed\]]
expected: FAIL