Repository navigation
Add tested Python examples for relative locators - #3018
Open
jaduichirag wants to merge 1 commit into
Open
jaduichirag wants to merge 1 commit into
jaduichirag wants to merge 1 commit into
Conversation
Move the inline Python snippets in the Relative Locators section (above, below, to_left_of, to_right_of, near, chaining) into tested code in examples/python/tests/elements/test_locators.py and reference them with gh-codeblock in all translations. Adds a small local HTML page matching the documentation diagram (email, password, cancel, submit) so the tests are deterministic. Part of SeleniumHQ#2890
👷 Deploy request for selenium-dev pending review.Visit the deploys page to approve it
|
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of #2890.
The Python tab of every example in the Relative Locators section of the Locators page (
above,below,to_left_of,to_right_of,near, and chaining) was inline, untested code. This PR moves them into tested examples and references them withgh-codeblock.examples/python/tests/elements/test_locators.py, one per relative locator. Each test asserts that the expected element is found.examples/python/tests/resources/relative_locators.html, a small page that matches the layout in the documentation diagram (email, password, Cancel, Submit). None of the hosted test pages has these element IDs. Loading the page locally keeps the tests deterministic.locators.en.md,locators.ja.md,locators.pt-br.mdandlocators.zh-cn.md. The code shown is unchanged apart from the addedfind_elementline.Motivation and Context
Issue #2890 asks for inline examples to be moved into tested code files so that the documentation stays correct.
Types of changes
Checklist
How tested
pytest tests/elements/test_locators.py -k relative: 6 passed (Selenium 4.54.0, Chrome, Windows).