Skip to content
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

Update _index.en.md with note about using XPATH values in an ID selector #1895

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

Convalytics
Copy link

@Convalytics Convalytics commented Aug 26, 2024

User description

Updated Invalid Selector Exception to note that it can also be caused when inputting an xpath value into an ID-based selector.

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

Additional error case noting that Invalid Selector Exception can also happen if you use XPATH with an ID selector.

Motivation and Context

I had this issue today because I changed my code to search by XPATH instead of ID, and I forgot to change the type from By.ID to By.XPATH.

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

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

PR Type

documentation


Description

  • Added documentation to clarify that an Invalid Selector Exception can occur if an XPATH value is used as a parameter to an ID selector.
  • Improved troubleshooting guidance for users encountering selector issues.

Changes walkthrough 📝

Relevant files
Documentation
_index.en.md
Update documentation for Invalid Selector Exception causes

website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md

  • Added a note about using XPATH values in an ID selector.
  • Clarified potential cause of Invalid Selector Exception.
  • +1/-0     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Updated Invalid Selector Exception to note that it can also be caused when inputting an xpath value into an ID-based selector.
    Copy link

    netlify bot commented Aug 26, 2024

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit f2c5394

    @CLAassistant
    Copy link

    CLA assistant check
    Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
    You have signed the CLA already but the status is still pending? Let us recheck it.

    @qodo-merge-pro qodo-merge-pro bot added documentation Improvements or additions to documentation Review effort [1-5]: 1 labels Aug 26, 2024
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No key issues to review

    Copy link
    Contributor

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Add a concrete example to illustrate the misuse of XPATH in an ID selector

    Provide a specific example of how an XPATH value might be incorrectly used in an ID
    selector to illustrate the point more clearly.

    website_and_docs/content/documentation/webdriver/troubleshooting/errors/_index.en.md [18]

    -This issue can also arise if you've placed an XPATH value as a parameter to an ID selector.
    +This issue can also arise if you've placed an XPATH value as a parameter to an ID selector. For example, using `driver.find_element(By.ID, "//input[@name='username']")` instead of `driver.find_element(By.XPATH, "//input[@name='username']")`.
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion provides a clear example that enhances understanding of the issue, improving the documentation's clarity and usefulness. However, it addresses a minor enhancement rather than a critical issue.

    7

    Copy link
    Contributor

    @shbenzer shbenzer left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    This should be moved into the Likely Causes subsection

    @shbenzer
    Copy link
    Contributor

    shbenzer commented Sep 18, 2024

    Thank you for the contribution @Convalytics! Before we can accept the PR a few things must be done first:

    1. Resolve the requested changes
    2. add your changes to all translations
    3. sign the Contributor License Agreement

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    documentation Improvements or additions to documentation Review effort [1-5]: 1
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants