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 documentation to show the alternative use of an environment variable #1950

Merged
merged 4 commits into from
Sep 20, 2024

Conversation

aguspe
Copy link
Contributor

@aguspe aguspe commented Sep 18, 2024

Description

This PR adds to the selenium_manager a section that clarifies how to use environment variables as an alternative to set up the driver path

Motivation and Context

After this feature was added SeleniumHQ/selenium#14287 we need to update our documentation to reflect the possibility to use env variables to set the driver as an alternative to Selenium manager for the Selenium users

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

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

PR Type

Documentation


Description

  • Added documentation sections in multiple languages to explain how to use environment variables for specifying driver paths.
  • Listed supported environment variables for different drivers such as SE_CHROMEDRIVER, SE_EDGEDRIVER, etc.
  • Provided examples and noted the feature's availability in the Selenium Ruby binding starting from version 4.25.0.

Changes walkthrough 📝

Relevant files
Documentation
selenium_manager.en.md
Document environment variable usage for driver paths         

website_and_docs/content/documentation/selenium_manager.en.md

  • Added section on using environment variables for driver paths.
  • Listed supported environment variables for different drivers.
  • Provided example for setting SE_CHROMEDRIVER.
  • Mentioned availability in Selenium Ruby binding version 4.25.0.
  • +18/-0   
    selenium_manager.ja.md
    Document environment variable usage for driver paths         

    website_and_docs/content/documentation/selenium_manager.ja.md

  • Added section on using environment variables for driver paths.
  • Listed supported environment variables for different drivers.
  • Provided example for setting SE_CHROMEDRIVER.
  • Mentioned availability in Selenium Ruby binding version 4.25.0.
  • +18/-0   
    selenium_manager.pt-br.md
    Document environment variable usage for driver paths         

    website_and_docs/content/documentation/selenium_manager.pt-br.md

  • Added section on using environment variables for driver paths.
  • Listed supported environment variables for different drivers.
  • Provided example for setting SE_CHROMEDRIVER.
  • Mentioned availability in Selenium Ruby binding version 4.25.0.
  • +18/-0   
    selenium_manager.zh-cn.md
    Document environment variable usage for driver paths         

    website_and_docs/content/documentation/selenium_manager.zh-cn.md

  • Added section on using environment variables for driver paths.
  • Listed supported environment variables for different drivers.
  • Provided example for setting SE_CHROMEDRIVER.
  • Mentioned availability in Selenium Ruby binding version 4.25.0.
  • +18/-0   

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

    Copy link

    netlify bot commented Sep 18, 2024

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit c3616ee

    @codiumai-pr-agent-pro codiumai-pr-agent-pro bot added documentation Improvements or additions to documentation Review effort [1-5]: 2 labels Sep 18, 2024
    Copy link
    Contributor

    PR Reviewer Guide 🔍

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

    Incomplete Information
    The documentation mentions that Ruby and Java bindings support environment variables for driver paths, but it doesn't specify which other bindings (if any) do not support this feature.

    Missing Information
    The documentation doesn't provide information on how to use these environment variables in Java, which is mentioned as a supported binding.

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Sep 18, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Security
    Add a security note about using environment variables for driver paths

    Mention the potential security implications of using environment variables for
    driver paths and suggest best practices for secure usage.

    website_and_docs/content/documentation/selenium_manager.en.md [329-331]

     ### Using an environment variable for the driver path
     It's possible to use an environment variable to specify the driver path without using Selenium Manager.
     The following environment variables are supported:
     
    +> **Security Note**: When using environment variables to specify driver paths, ensure that the paths and the driver executables are secured against unauthorized access or modification. It's recommended to use this feature in controlled environments and to regularly update your drivers to the latest secure versions.
    +
    • Apply this suggestion
    Suggestion importance[1-10]: 10

    Why: Highlighting security implications and best practices is crucial for ensuring safe usage of environment variables, making this suggestion highly valuable for maintaining secure software practices.

    10
    Enhancement
    Add code examples demonstrating the use of environment variables in Ruby and Java

    Include information about how to use these environment variables in code examples
    for Ruby and Java, as these are the mentioned supported bindings.

    website_and_docs/content/documentation/selenium_manager.en.md [340-345]

     The following bindings allow you to specify the driver path using an environment variable:
     
    -* Ruby
    -* Java
    +* Ruby (available from version 4.25.0):
    +  ```ruby
    +  driver = Selenium::WebDriver.for :chrome
    +  # The driver will automatically use the path specified in SE_CHROMEDRIVER
    +  ```
     
    -This feature is available in the Selenium Ruby binding starting from version 4.25.0.
    +* Java:
    +  ```java
    +  WebDriver driver = new ChromeDriver();
    +  // The driver will automatically use the path specified in SE_CHROMEDRIVER
    +  ```
     
    +Note: Ensure that you've set the environment variable before running your tests.
    +
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: Including code examples for Ruby and Java significantly improves the documentation by providing practical guidance on how to use the feature, which is especially beneficial for users of these languages.

    9
    Clarify the precedence of environment variables over Selenium Manager

    Consider adding a note about the precedence of environment variables over Selenium
    Manager. This will help users understand how the system behaves when both methods
    are used.

    website_and_docs/content/documentation/selenium_manager.en.md [329-331]

     ### Using an environment variable for the driver path
    -It's possible to use an environment variable to specify the driver path without using Selenium Manager.
    +It's possible to use an environment variable to specify the driver path without using Selenium Manager. When both an environment variable and Selenium Manager are used, the environment variable takes precedence.
     The following environment variables are supported:
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: This suggestion provides important clarification on the precedence of environment variables over Selenium Manager, which can prevent user confusion and potential misconfigurations.

    8
    Provide examples of setting environment variables in different operating systems

    Add an example of how to set the environment variable in different operating systems
    to make it easier for users to implement.

    website_and_docs/content/documentation/selenium_manager.en.md [339]

    -For example, to specify the path to the chromedriver, you can set the `SE_CHROMEDRIVER` environment variable to the path of the chromedriver executable.
    +For example, to specify the path to the chromedriver, you can set the `SE_CHROMEDRIVER` environment variable to the path of the chromedriver executable:
     
    +On Unix-based systems:
    +```
    +export SE_CHROMEDRIVER=/path/to/chromedriver
    +```
    +
    +On Windows:
    +```
    +set SE_CHROMEDRIVER=C:\path\to\chromedriver.exe
    +```
    +
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Adding examples for setting environment variables on different operating systems enhances usability and helps users implement the feature more easily.

    7

    💡 Need additional feedback ? start a PR chat

    @aguspe
    Copy link
    Contributor Author

    aguspe commented Sep 20, 2024

    Ready for re-review @harsha509

    Copy link
    Member

    @harsha509 harsha509 left a comment

    Choose a reason for hiding this comment

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

    Thank you @aguspe !

    @harsha509 harsha509 merged commit e92fc16 into SeleniumHQ:trunk Sep 20, 2024
    3 checks passed
    selenium-ci added a commit that referenced this pull request Sep 20, 2024
    …ble (#1950)[deploy site]
    
    * Add documentation to show the alternative use of an environment variable
    
    * Update line length
    
    ---------
    
    Co-authored-by: Sri Harsha <[email protected]> e92fc16
    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]: 2
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    4 participants