Skip to content

Add runnable shadow DOM finder examples for all bindings - #2875

Merged
diemol merged 2 commits into
trunkfrom
shadow-dom-finder-examples
Oct 8, 2026
Merged

diemol merged 2 commits into
trunkfrom
shadow-dom-finder-examples

Conversation

@diemol

@diemol diemol commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

  • Adds a shadow DOM finder test to the Java, C#, Ruby, JavaScript and Kotlin examples, using https://www.selenium.dev/selenium/web/shadowRootPage.html (same page as the existing Python example).
  • Replaces the inline Java/C#/Ruby snippets and the JavaScript/Kotlin "code coming soon" badges in the "Evaluating the Shadow DOM" section with gh-codeblock references, in en, ja, pt-br and zh-cn.
  • Shifts the other Java line ranges on the page by one for the new SearchContext import.

Motivation and Context

The Shadow DOM section was the last part of the finders page still using inline code. With this, every tab on the page points at tested examples.

Fixes #2037

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

🤖 Generated with Claude Code

Replace the inline Shadow DOM snippets on the finders page with
gh-codeblock references to tested examples in Java, C#, Ruby,
JavaScript and Kotlin, across all translations.

Fixes #2037

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Add tested Shadow DOM finder examples across all bindings

📝 Documentation 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds Shadow DOM finder tests for Java, C#, Ruby, JavaScript, and Kotlin using the existing Python
 fixture.
• Replaces inline snippets and placeholders with tested examples across four documentation locales.
• Corrects Java snippet line ranges after adding the SearchContext import.
Diagram

graph TD
  A["Localized finder pages"] --> B["gh-codeblock shortcode"] --> C["Five binding tests"] --> E["Shadow DOM page"]
  B --> D["Existing Python test"] --> E
Loading
High-Level Assessment

Using runnable tests as documentation sources follows the page’s existing gh-codeblock pattern and avoids maintaining separate inline snippets. Retaining inline examples would leave the documentation unverified.

Files changed (9) +127 / -96

Tests (5) +59 / -0
FindersTest.csAdd C# Shadow DOM finder test +13/-0

Add C# Shadow DOM finder test

• Adds an MSTest that opens the shared Shadow DOM page, searches the shadow root for its checkbox, and asserts the checkbox is displayed.

examples/dotnet/SeleniumDocs/Elements/FindersTest.cs

FindersTest.javaAdd Java Shadow DOM finder test +13/-0

Add Java Shadow DOM finder test

• Imports SearchContext and adds a JUnit test that locates a checkbox within a shadow root and verifies it is displayed. The import shifts earlier documentation snippet lines by one.

examples/java/src/test/java/dev/selenium/elements/FindersTest.java

finders.spec.jsAdd JavaScript Shadow DOM finder test +12/-0

Add JavaScript Shadow DOM finder test

• Adds an asynchronous browser test that finds the shadow-root checkbox, checks its visibility, and closes the driver.

examples/javascript/test/elements/finders.spec.js

FindersTest.ktAdd Kotlin Shadow DOM finder test +11/-0

Add Kotlin Shadow DOM finder test

• Adds a JUnit test that accesses a shadow root, finds its checkbox, and asserts it is displayed.

examples/kotlin/src/test/kotlin/dev/selenium/elements/FindersTest.kt

finders_spec.rbAdd Ruby Shadow DOM finder test +10/-0

Add Ruby Shadow DOM finder test

• Adds an RSpec example that searches within the shadow root and expects the checkbox to be displayed.

examples/ruby/spec/elements/finders_spec.rb

Documentation (4) +68 / -96
finders.en.mdSource English Shadow DOM snippets from tests +17/-24

Source English Shadow DOM snippets from tests

• Replaces inline snippets and missing-code badges with gh-codeblock references for all six bindings. Adjusts the page’s other Java snippet ranges for the new import.

website_and_docs/content/documentation/webdriver/elements/finders.en.md

finders.ja.mdSource Japanese-page Shadow DOM snippets from tests +17/-24

Source Japanese-page Shadow DOM snippets from tests

• Links every Shadow DOM language tab to its example source and removes inline snippets and placeholders. Shifts the other Java snippet ranges by one.

website_and_docs/content/documentation/webdriver/elements/finders.ja.md

finders.pt-br.mdSource Portuguese-page Shadow DOM snippets from tests +17/-24

Source Portuguese-page Shadow DOM snippets from tests

• Replaces Shadow DOM inline code and placeholders with source-backed examples for all bindings. Corrects the other Java snippet ranges.

website_and_docs/content/documentation/webdriver/elements/finders.pt-br.md

finders.zh-cn.mdSource Chinese-page Shadow DOM snippets from tests +17/-24

Source Chinese-page Shadow DOM snippets from tests

• Connects all Shadow DOM tabs to example files instead of inline code or placeholders. Updates the other Java snippet ranges to account for the import.

website_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md

@netlify

netlify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for selenium-dev ready!

Name Link
🔨 Latest commit 2e7e8b6
🔍 Latest deploy log https://app.netlify.com/projects/selenium-dev/deploys/6ac7c1bd5c0dce0008b8a69e
😎 Deploy Preview https://deploy-preview-2875--selenium-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@qodo-code-review

qodo-code-review Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Seven Java snippet links stay indented ✓ Resolved
Description
The seven updated Java gh-codeblock directives in finders.en.md retain two leading spaces. Each
changed reference remains indented inside its tab, while the newly added Shadow DOM references start
at column zero.
Code

website_and_docs/content/documentation/webdriver/elements/finders.en.md[41]

+  {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/elements/FindersTest.java#L23-L24">}}
Evidence
Rule 2 requires unindented gh-codeblock lines. The cited updated reference, like the other six
listed in the fix focus areas, begins with two spaces.

AGENTS.md: Use Correctly Formatted gh-codeblock References for Runnable Examples
website_and_docs/content/documentation/webdriver/elements/finders.en.md[39-42]
website_and_docs/content/documentation/webdriver/elements/finders.en.md[136-139]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Seven updated Java `gh-codeblock` references in the English finders page remain indented.

## Fix Focus Areas
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[41-41]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[70-70]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[137-137]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[166-166]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[192-192]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[218-218]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[243-243]

## Recommended Fix
Remove the two leading spaces from each listed `gh-codeblock` line without changing its path or range.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: Auto: 🚀 Fast: Localized documentation shortcode indentation changes pose limited rendering risk.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 2e7e8b6

Results up to commit 1cadb00 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Action required
1. Seven Java snippet links stay indented ✓ Resolved
Description
The seven updated Java gh-codeblock directives in finders.en.md retain two leading spaces. Each
changed reference remains indented inside its tab, while the newly added Shadow DOM references start
at column zero.
Code

website_and_docs/content/documentation/webdriver/elements/finders.en.md[41]

+  {{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/elements/FindersTest.java#L23-L24">}}
Evidence
Rule 2 requires unindented gh-codeblock lines. The cited updated reference, like the other six
listed in the fix focus areas, begins with two spaces.

AGENTS.md: Use Correctly Formatted gh-codeblock References for Runnable Examples
website_and_docs/content/documentation/webdriver/elements/finders.en.md[39-42]
website_and_docs/content/documentation/webdriver/elements/finders.en.md[136-139]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Seven updated Java `gh-codeblock` references in the English finders page remain indented.

## Fix Focus Areas
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[41-41]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[70-70]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[137-137]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[166-166]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[192-192]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[218-218]
- website_and_docs/content/documentation/webdriver/elements/finders.en.md[243-243]

## Recommended Fix
Remove the two leading spaces from each listed `gh-codeblock` line without changing its path or range.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread website_and_docs/content/documentation/webdriver/elements/finders.en.md Outdated
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 2e7e8b6

@diemol
diemol merged commit ee11e89 into trunk Oct 8, 2026
28 of 29 checks passed
@diemol
diemol deleted the shadow-dom-finder-examples branch October 8, 2026 20:32
selenium-ci added a commit that referenced this pull request Oct 8, 2026
* Add runnable shadow DOM finder examples for all bindings

Replace the inline Shadow DOM snippets on the finders page with
gh-codeblock references to tested examples in Java, C#, Ruby,
JavaScript and Kotlin, across all translations.

Fixes #2037

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Unindent gh-codeblock lines on English finders page

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

[deploy site] ee11e89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🚀 Feature]: Rewriting Webdriver > Elements > Finders to Not Use HTML Snippet

1 participant