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

add locators.html file in static web pages #14905

Merged
merged 4 commits into from
Dec 23, 2024

Conversation

navin772
Copy link
Contributor

@navin772 navin772 commented Dec 17, 2024

User description

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

I was trying to move code in the selenium docs for which I need to serve this html file.
https://www.selenium.dev/documentation/webdriver/elements/locators/ - contains the source code for it.

This is the docs PR - SeleniumHQ/seleniumhq.github.io#2102

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Enhancement, Documentation


Description

  • Added new HTML file (locators.html) to support Selenium documentation for element locators
  • Created a simple contact form with various HTML elements for testing different locator strategies:
    • Radio buttons for gender selection
    • Text input fields with IDs and classes
    • Checkbox for newsletter subscription
    • Submit button
  • Includes basic CSS styling for form elements
  • File will be used as a reference in Selenium's documentation for demonstrating locator usage

Changes walkthrough 📝

Relevant files
Enhancement
locators.html
Add HTML test page for locator examples                                   

common/src/web/locators_tests/locators.html

  • Added new HTML file with a contact form containing various input
    elements (radio buttons, text fields, checkbox)
  • Included styling for information class with white background
  • Added link to Selenium's official page
  • +30/-0   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 Security concerns

    Form endpoint security:
    The form action points to "/action_page.php" which could potentially expose form data if not properly configured. Since this appears to be a test/documentation page, the form action should either be removed or point to a proper endpoint.

    ⚡ Recommended focus areas for review

    Form Security
    The form action points to a non-existent PHP page. This should be updated to point to a valid endpoint or removed if the form is only for demonstration purposes.

    Accessibility Issue
    The newsletter checkbox lacks an explicit label association using the for attribute, unlike other form elements. This impacts accessibility.

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    Add HTML5 doctype and essential meta tags for proper browser rendering and accessibility

    Add proper HTML5 doctype declaration and charset meta tag to ensure consistent
    rendering across browsers and proper character encoding.

    common/src/web/locators_tests/locators.html [1-2]

    -<html>
    +<!DOCTYPE html>
    +<html lang="en">
    +<head>
    +    <meta charset="UTF-8">
    +</head>
     <body>
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Adding proper HTML5 doctype and meta tags is important for consistent browser rendering and accessibility. This is a fundamental best practice that affects the entire document.

    7
    Add form validation to ensure required fields are filled before submission

    Add form validation attributes to ensure data integrity and improve user experience
    by indicating required fields.

    common/src/web/locators_tests/locators.html [17-19]

    -<input class="information" type="text" id="fname" name="fname" value="Jane">
    -<input class="information" type="text" id="lname" name="lname" value="Doe">
    +<input class="information" type="text" id="fname" name="fname" value="Jane" required>
    +<input class="information" type="text" id="lname" name="lname" value="Doe" required>
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Adding required field validation improves form usability and data integrity by preventing empty submissions. This is a good practice for form handling.

    6

    @diemol diemol merged commit 5cc56b0 into SeleniumHQ:trunk Dec 23, 2024
    1 check passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants