Bug 230614

Summary: [WebDriver] Add support for shadow roots
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebDriverAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, bburg, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=230551
Attachments:
Description Flags
Patch aperez: review+

Description Carlos Garcia Campos 2021-09-22 05:35:46 PDT
See https://w3c.github.io/webdriver/#shadow-root, https://w3c.github.io/webdriver/#find-element-from-shadow-root, https://w3c.github.io/webdriver/#find-elements-from-shadow-root and https://w3c.github.io/webdriver/#get-element-shadow-root

imported/w3c/webdriver/tests/find_element_from_shadow_root/
imported/w3c/webdriver/tests/find_elements_from_shadow_root/
imported/w3c/webdriver/tests/get_element_shadow_root/
Comment 1 Radar WebKit Bug Importer 2021-09-29 05:36:25 PDT
<rdar://problem/83667535>
Comment 2 Carlos Garcia Campos 2022-02-01 04:25:02 PST
Created attachment 450514 [details]
Patch
Comment 3 Adrian Perez 2022-02-04 06:26:09 PST
Comment on attachment 450514 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450514&action=review

> Source/WebDriver/Session.cpp:1139
> +                if (isShadowRoot == ElementIsShadowRoot::Yes && result.errorString() == "stale element reference") {

Wouldn't it be more robust to compare the error code instead of comparing
strings? As in:

  result.errorCode == CommandResult::ErrorCode::StaleElementReference

> Source/WebDriver/WebDriverService.cpp:1461
>  }

These two functions are so similar... the only variation AFAICS is
using FindElementsMode::{Multiple,Single} in the last line; maybe most
of the function body could be factored out?
Comment 4 Carlos Garcia Campos 2022-02-07 02:25:26 PST
Committed r289202 (?): <https://commits.webkit.org/r289202>