Bug 230614 - [WebDriver] Add support for shadow roots
Summary: [WebDriver] Add support for shadow roots
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-22 05:35 PDT by Carlos Garcia Campos
Modified: 2022-02-07 02:25 PST (History)
3 users (show)

See Also:


Attachments
Patch (26.44 KB, patch)
2022-02-01 04:25 PST, Carlos Garcia Campos
aperez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>