Fix missing Java examples for ByChained/ByAll locator strategies - #2738
Conversation
A prior refactor (#2583) deleted LocatorsTest.java while consolidating Java locator examples into LocatorTest.java, but left the "ByChained" and "ByAll" sections of the Locator Strategies doc (all four languages) pointing at the now-deleted file, so those gh-codeblock references resolved to nothing. Add testByAll and testByChained to LocatorTest.java, and repoint the en/ja/pt-br/zh-cn docs at LocatorTest.java with corrected line ranges (existing references also shifted +3 lines from the new imports). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ Deploy Preview for selenium-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
PR Summary by QodoRestore Java ByAll/ByChained examples and fix locator docs codeblocks
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
10 rules 1.
|
- De-indent gh-codeblock shortcode lines for the Java tabs (style guide
requires column-1 placement; these were indented pre-existing).
- Add missing trailing newline to LocatorTest.java.
- Use By.tagName("input") instead of a duplicate By.id() as the
ByChained child locator so the example actually demonstrates scoping
a lookup within a parent, rather than chaining two already-unique ids.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Code review by qodo was updated up to the latest commit bb430d6 |
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
testByAllandtestByChainedmethods toexamples/java/src/test/java/dev/selenium/elements/LocatorTest.java, and updates the Locator Strategies documentation (en, ja, pt-br, zh-cn) to reference them with corrected line numbers.Motivation and Context
Reported in #2620 ("Missing Java examples for Locator strategies").
A prior refactor (#2583) consolidated the Java locator examples into
LocatorTest.javaand deleted the oldLocatorsTest.java, but the "ByChained" and "ByAll" sections of the Locator Strategies doc, in all four languages, were left pointing at the deleted file. Thosegh-codeblockreferences resolved to nothing since the file no longer exists.This adds real, runnable implementations of
ByAllandByChained(verified againsthttps://www.selenium.dev/selenium/web/login.html) toLocatorTest.java, and repoints the four language docs at the correct file. Adding the new imports shifted every existing line number in the file by 3, so the doc's other Javagh-codeblockreferences (class name, css selector, id, name, link text, partial link text, tag name, xpath) were also updated to match.Note: the "Relative Locators" section (above/below/left of/right of/near/chaining) still uses hardcoded snippets rather than
gh-codeblockfor all languages, not just Java — that's a larger change (needs a fixture page with matching elements) and is left out of this PR to keep it focused.Types of changes
Checklist
Closes #2620.