You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
there was a mistake raised in PR #2221 this PR fixes it.
Description
in the python code, the driver should be element, as we are now fetching all the child 'li' elements inside 'ul' parent element.
I have used hugo to render the site/docs locally and I am sure it works.
PR Type
Bug fix
Description
Fix incorrect variable usage in Python code examples
Change driver.find_elements() to element.find_elements()
Update documentation across multiple language versions
Diagram Walkthrough
flowchart LR
A["driver.find_element()"] --> B["element variable"]
B --> C["element.find_elements()"]
D["driver.find_elements()"] -.-> C
D -.-> E["❌ Incorrect usage"]
C --> F["✅ Correct usage"]
Check code block indentation consistency around the inserted line to ensure it renders correctly within tabbed code blocks.
element = driver.find_element(By.XPATH, '//ul')
# get children of tag 'ul' with tag 'li'
elements = element.find_elements(By.XPATH, './/li')
for e in elements:
print(e.text)
Verify the whitespace/indentation matches surrounding code to avoid misaligned code rendering in the docs tab.
element = driver.find_element(By.XPATH, '//ul')
# get children of tag 'ul' with tag 'li'
elements = element.find_elements(By.XPATH, './/li')
for e in elements:
print(e.text)
{{< /tab >}}
Ensure consistent indentation and spacing in the code block after changing the call site.
element = driver.find_element(By.XPATH, '//ul')
# get children of tag 'ul' with tag 'li'
elements = element.find_elements(By.XPATH, './/li')
for e in elements:
print(e.text)
{{< /tab >}}
Use a direct-child XPath to match the comment "get children" and avoid selecting nested descendants. Replace .//li with ./li so only immediate li children of the ul are returned.
Why: The suggestion correctly points out that using ./li instead of .//li more accurately reflects the comment "get children", as it selects only direct children instead of all descendants. This improves the precision and clarity of the documentation example.
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
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.
User description
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.
there was a mistake raised in PR #2221 this PR fixes it.
Description
in the python code, the driver should be element, as we are now fetching all the child 'li' elements inside 'ul' parent element.
Motivation and Context
Fixes #2221
Types of changes
Checklist
PR Type
Bug fix
Description
Fix incorrect variable usage in Python code examples
Change
driver.find_elements()toelement.find_elements()Update documentation across multiple language versions
Diagram Walkthrough
File Walkthrough
finders.en.md
Fix variable reference in English docswebsite_and_docs/content/documentation/webdriver/elements/finders.en.md
driver.find_elements()toelement.find_elements()in Pythoncode example
finders.ja.md
Fix variable reference in Japanese docswebsite_and_docs/content/documentation/webdriver/elements/finders.ja.md
driver.find_elements()toelement.find_elements()in Pythoncode example
finders.pt-br.md
Fix variable reference in Portuguese docswebsite_and_docs/content/documentation/webdriver/elements/finders.pt-br.md
driver.find_elements()toelement.find_elements()in Pythoncode example
finders.zh-cn.md
Fix variable reference in Chinese docswebsite_and_docs/content/documentation/webdriver/elements/finders.zh-cn.md
driver.find_elements()toelement.find_elements()in Pythoncode example