Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add initial support for shadow_root #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
til wants to merge 1 commit into rubycdp:main
base: main
Choose a base branch
Loading
from til:initial-shadow-root-support

Conversation

@til
Copy link

@til til commented Apr 29, 2023

Capybara added support to access an element's shadow DOM with Element#shadow_root in teamcapybara/capybara#2546 – it would be nice if Cuprite supported it too.

Here is an attempt at that. Not sure if it does everything as it should, but the specs are passing locally and I've used it successfully in a project's test suite where

# this
expect(
 evaluate_script('arguments[0].shadowRoot', page.find('.a-shadow-host'))
).to have_selector('.inside-shadow-dom')
# could be replaced with this
expect(
 page.find('.a-shadow-host').shadow_root
).to have_selector('.inside-shadow-dom')

The spec "produces error messages when failing" provided by Capybara needed to be adapted because the generated error message includes the value of tagName which is different between Selenium and Cuprite.

The added spec "extends visibility check across shadow host boundary" covers a behaviour that Selenium implements this way: the visibility of the shadow propagates down to its children.

wusher, gabrielrios, and taf2 reacted with thumbs up emoji
@til til force-pushed the initial-shadow-root-support branch from bff3d8f to ceb4f86 Compare December 9, 2023 12:35
Copy link

FWIW I've been playing around fixing some Shadow DOM issue using https://github.com/yuki24/capybara-shadowdom It still didn't play ball with likes of clicks not working because of some overlapping element issues.

let element = node.getRootNode().elementFromPoint(x, y); in this PR seems to be the magic sauce so having this available would be neat

til reacted with thumbs up emoji

@til til force-pushed the initial-shadow-root-support branch from ceb4f86 to 1578943 Compare March 23, 2024 14:36
Copy link

Hey! This fork has worked well for my use case – what else needs to be done to get it merged?

@til til force-pushed the initial-shadow-root-support branch from 1578943 to 9756aa7 Compare September 19, 2024 13:36
Copy link
Author

til commented Sep 23, 2024

Unfortunately I don't know – I can only say that it's still working fine for me as well. Rebased, the spec failures are unrelated (and about to be fixed with #273).

boardfish reacted with hooray emoji

Copy link

Maybe it's worth rebasing this onto that branch and requesting a review from @/route once it's all green? Really like what you've done here, it'd be great to get it into Cuprite stable so that we can depend on it with confidence 🎉

@til til force-pushed the initial-shadow-root-support branch from 9756aa7 to 22d9130 Compare December 30, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /