w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
676 stars 190 forks source link

Safari is unable to get text from components with Shadow DOM #1786

Closed christian-bromann closed 5 months ago

christian-bromann commented 5 months ago

I am running into a Safari issue where the /text command fails to include text of an element with a Shadow DOM. The structure of the component looks as following:

Screenshot 2024-01-26 at 9 42 47 AM

The element id of the div with class name app-profile was obtained an is node-E5A41EF6-1F5A-4E81-ACC7-69E3AC28247B. Now, when calling the /text command all it returns in the following:

2024-01-26T17:42:02.375Z INFO webdriver: COMMAND getElementText("node-E5A41EF6-1F5A-4E81-ACC7-69E3AC28247B")
2024-01-26T17:42:02.376Z INFO webdriver: [GET] http://0.0.0.0:64364/session/D505F956-4EF8-4BD7-825E-8B89EEC55FBB/element/node-E5A41EF6-1F5A-4E81-ACC7-69E3AC28247B/text
2024-01-26T17:42:02.379Z INFO webdriver: RESULT Hello! My name is Stencil.

This differentiates from Chromium and Gecko where the same command yields the text of nested Shadow DOMs:

2024-01-26T17:47:31.058Z INFO webdriver: COMMAND getElementText("D1D72808399D841D1198CF0F63D7F42A_element_5")
2024-01-26T17:47:31.058Z INFO webdriver: [GET] http://0.0.0.0:64658/session/7586ddad61c23653a234828ae154ad4e/element/D1D72808399D841D1198CF0F63D7F42A_element_5/text
2024-01-26T17:47:31.066Z INFO webdriver: RESULT Hello! My name is Stencil.
I am a nested component!
whimboo commented 5 months ago

@christian-bromann this sounds like a bug in safaridriver / Safari and not for the webdriver specification. You probably want to file a bug on Apple's side.

christian-bromann commented 5 months ago

Yes, you right! Sorry for the noise.