Skip to content

Added Example for Running Python Script to first_script.mds #1861

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

Merged
merged 3 commits into from
Aug 17, 2024
Merged

Added Example for Running Python Script to first_script.mds #1861

merged 3 commits into from
Aug 17, 2024

Conversation

shbenzer
Copy link
Contributor

@shbenzer shbenzer commented Aug 17, 2024

User description

Added example of running a python file to first_script.mds and examples/python/README.md

Description

  1. added {{< gh-codeblock path="examples/python/README.md#L35" >}} to first_script.mds in all languages
  2. added a section to examples/python/readme.md describing how to run a python file
  3. fixed an erroneous curly brace in the chinese translation

Motivation and Context

I wanted to ensure people could get everything they needed from the documentation page "Write Your First Selenium Script"

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 instructions for executing specific Selenium Python examples in examples/python/README.md.
  • Updated multiple language documentation files to include a reference to the Python example.
  • Fixed a translation error in the Chinese documentation.

Changes walkthrough 📝

Relevant files
Documentation
README.md
Add instructions for running Python examples                         

examples/python/README.md

  • Added instructions to execute a specific Selenium Python example.
  • Provided a command example for running a Python script.
  • +8/-0     
    first_script.en.md
    Include Python example reference in English documentation

    website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md

    • Added a code block reference for running Python examples.
    +1/-0     
    first_script.ja.md
    Include Python example reference in Japanese documentation

    website_and_docs/content/documentation/webdriver/getting_started/first_script.ja.md

    • Added a code block reference for running Python examples.
    +1/-0     
    first_script.pt-br.md
    Include Python example reference in Portuguese documentation

    website_and_docs/content/documentation/webdriver/getting_started/first_script.pt-br.md

    • Added a code block reference for running Python examples.
    +1/-0     
    first_script.zh-cn.md
    Fix translation and add Python example in Chinese documentation

    website_and_docs/content/documentation/webdriver/getting_started/first_script.zh-cn.md

  • Fixed an erroneous curly brace in the Chinese translation.
  • Added a code block reference for running Python examples.
  • +2/-1     

    💡 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 Aug 17, 2024

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit b497b80

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

    PR Reviewer Guide 🔍

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

    Copy link
    Contributor

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Include information about installing necessary dependencies before running the script

    Add a note about potential dependencies that need to be installed before running the
    script, such as Selenium itself.

    examples/python/README.md [38]

     Make sure to replace `first_script.py` with the path and name of the example you want to run.
     
    +Note: Ensure that you have installed all necessary dependencies (e.g., Selenium) before running the script:
    +```bash
    +pip install selenium
    +```
    +
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: Adding a note about installing dependencies like Selenium is crucial for users who may not have them installed, ensuring the script runs smoothly.

    9
    Add a descriptive comment to provide context for the code block

    Consider adding a brief description or comment about what the code block represents,
    to provide context for the reader.

    website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md [235-237]

     {{< tab header="Python" >}}
    +<!-- Example of running a Python Selenium script -->
     {{< gh-codeblock path="examples/python/README.md#L35" >}}
     {{< badge-code >}}
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Providing context for the code block enhances readability and understanding, especially for users unfamiliar with the example.

    7
    Best practice
    Add instructions for activating a virtual environment before running the Python script

    Consider adding a note about the potential need to activate a virtual environment
    before running the Python script. This can help users avoid common setup issues.

    examples/python/README.md [32-36]

     ## Execute a specific example
    -To run a specific Selenium Python example, use the following command:
    +To run a specific Selenium Python example, follow these steps:
    +
    +1. Activate your virtual environment (if you're using one):
    +```bash
    +source venv/bin/activate  # On Unix or MacOS
    +venv\Scripts\activate.bat  # On Windows
    +```
    +
    +2. Run the Python script:
     ```bash
     python first_script.py
    
    - [ ] **Apply this suggestion** <!-- /improve --apply_suggestion=2 -->
    
    <details><summary>Suggestion importance[1-10]: 8</summary>
    
    Why: This suggestion is valuable as it addresses a common setup step that users might overlook, which can prevent potential issues when running the script.
    
    
    </details></details></td><td align=center>8
    
    </td></tr><tr><td rowspan=1><strong>Consistency</strong></td>
    <td>
    
    
    
    <details><summary>Ensure consistent formatting of code blocks across different language versions</summary>
    
    ___
    
    
    **Ensure consistency in the formatting of the code blocks across different language <br>versions. The Java code block is missing the closing tag in the old version, which <br>has been fixed in the new version. Apply similar formatting to the Python code <br>block.**
    
    [website_and_docs/content/documentation/webdriver/getting_started/first_script.zh-cn.md [247-252]](https://github.com/SeleniumHQ/seleniumhq.github.io/pull/1861/files#diff-9410091994b973ef73f08c08ee361a79d99eea7e91ff75b69d70fa7acba71cadR247-R252)
    
    ```diff
     {{< tab header="Java" >}}
     {{< gh-codeblock path="examples/java/README.md#L60" >}}
     {{< /tab >}}
     {{< tab header="Python" >}}
     {{< gh-codeblock path="examples/python/README.md#L35" >}}
    -{{< badge-code >}}
    +{{< /tab >}}
     
    
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Consistent formatting improves the documentation's professionalism and readability, although the impact is minor compared to functional improvements.

    6

    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 @shbenzer!

    @harsha509 harsha509 merged commit 5b07b27 into SeleniumHQ:trunk Aug 17, 2024
    9 checks passed
    @harsha509
    Copy link
    Member

    Congratulations on your first contribution to Selenium Docs @shbenzer 🎉 🎉 🎉 !

    selenium-ci added a commit that referenced this pull request Aug 17, 2024
    …eploy site]
    
    * added code for running first_script.py in python example
    
    * added first_script example to all translated languages
    
    ---------
    
    Co-authored-by: Sri Harsha <12621691+harsha509@users.noreply.github.com> 5b07b27
    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.

    2 participants