-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Java code examples added for various locator types #2271
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
base: trunk
Are you sure you want to change the base?
Java code examples added for various locator types #2271
Conversation
In this commit i have added the code inside LocatorsTest, for various types of locators (className, id, xpath), and reffered that code in the corresponding documentation files. This commit intends in helping to "move code" for elements -> locators -> java bindings.
👷 Deploy request for selenium-dev pending review.Visit the deploys page to approve it
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
In this commit i have added the code inside LocatorsTest, for various types of locators (className, id, xpath), and reffered that code in the corresponding documentation files.
This PR intends in helping to "move code" for elements -> locators -> java bindings.
Right now i haven't added the code examples for relative locators, because i felt there are different websites to show the practical code examples for the same.
Although that code is also ready, if you feel its fine, then in the next commit i can include the following code, and make appropriate changes in the documentation files. But in this case, i guess we will have to change the static image (that is currently attached), or give a better context, that how we are using multiple websites to show the relative locators strategies.
Also i haven't added any assertions, since they were not present before, although if you want i can add assertion and convert each method as a test case too.
I wasn't able to verify the changes by running hugo server cause the required code only doesn't exist, and its being added right now.
Please let me know if any changes are needed.
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
Motivation and Context
Types of changes
Checklist
PR Type
Documentation, Enhancement
Description
Added Java methods for various locator strategies (className, id, cssSelector, etc.) in
LocatorsTest
.Introduced relative locators and their usage in Java, with examples for
above
,below
,toLeftOf
, andtoRightOf
.Updated formatting, alignment, and examples in locators documentation across multiple languages (Portuguese, Chinese, Japanese, and English).
Replaced inline code examples in documentation with references to external Java code files.
Improved descriptions, explanations, and clarity for locator strategies in the documentation.
Changes walkthrough 📝
locators.pt-br.md
Improved formatting and examples in Portuguese locators documentation.
website_and_docs/content/documentation/webdriver/elements/locators.pt-br.md
locators.zh-cn.md
Improved formatting and examples in Chinese locators documentation.
website_and_docs/content/documentation/webdriver/elements/locators.zh-cn.md
locators.ja.md
Improved formatting and examples in Japanese locators documentation.
website_and_docs/content/documentation/webdriver/elements/locators.ja.md
locators.en.md
Improved formatting and added Java code references in locators
documentation.
website_and_docs/content/documentation/webdriver/elements/locators.en.md
documentation.
LocatorsTest
file.
relative locators.
LocatorsTest.java
Added Java examples for locator strategies in Selenium tests.
examples/java/src/test/java/dev/selenium/elements/LocatorsTest.java
cssSelector, etc.).
By
locators and chaining locators.