Skip to content

Conversation

@zipperer
Copy link
Contributor

@zipperer zipperer commented Oct 6, 2024

User description

Description

On page
https://www.selenium.dev/documentation/webdriver/getting_started/first_script/ in section "7. Request element information"
Python example shows getting message element

message = driver.find_element(by=By.ID, value="message")

instead of getting message element information

text = message.text

20241006-selenium-website-codeblock-python-get-message-element-english

The examples for other programming languages show getting the text attribute of the message element, e.g.

20241006-selenium-website-codeblock-java-get-message-element-attribute

And the examples for Python in other spoken languages show getting the text attribute of the message element.

20241006-selenium-website-codeblock-python-get-message-element-not-english

This commit changes the English markdown file. It edits the code reference to the Python file from L18 to L19.
This makes the Python example show getting the text attribute from the message element.

After this change:

  • the Python example is like the examples for other programming languages
  • the Python example on first_script.en.md is like the Python example for these: first_script.{zh-cn,pt-br,ja}.md

Motivation and Context

Align code examples across programming languages and spoken languages.

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

  • Updated the Python example in the Selenium documentation to retrieve the text attribute of the message element, aligning it with examples in other programming languages.
  • Changed the code reference in the English markdown file from line 18 to line 19 to reflect this update.
  • Ensured consistency across different spoken languages by making the Python example similar to those in first_script.{zh-cn,pt-br,ja}.md.

Changes walkthrough 📝

Relevant files
Documentation
first_script.en.md
Align Python code example with other languages in documentation

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

  • Updated code reference from line 18 to line 19 in the Python example.
  • Ensured consistency with other language examples by showing how to get
    the text attribute.
  • +1/-1     

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

    On page
    https://www.selenium.dev/documentation/webdriver/getting_started/first_script/
    in section "7. Request element information"
    Python example shows getting message element
    ```python3
    message = driver.find_element(by=By.ID, value="message")
    ```
    instead of getting message element information
    ```python3
    text = message.text
    ```
    
    The examples for other programming languages show getting the `text` attribute
    of the `message` element. And the examples for Python in other spoken
    languages show getting the `text` attribute of the `message` element.
    
    This commit changes the code reference to the Python file from L18 to
    L19 in the English markdown file.
    This makes the Python example show getting the `text` attribute from the
    `message` element.
    After this change:
    - the Python example is like the examples for other programming
    languages
    - the Python example on first_script.en.md is like the Python example
    for these: first_script.{zh-cn,pt-br,ja}.md
    @netlify
    Copy link

    netlify bot commented Oct 6, 2024

    👷 Deploy request for selenium-dev pending review.

    Visit the deploys page to approve it

    Name Link
    🔨 Latest commit 82e5bbe

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

    qodo-merge-pro bot commented Oct 6, 2024

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    @qodo-merge-pro
    Copy link
    Contributor

    qodo-merge-pro bot commented Oct 6, 2024

    PR Code Suggestions ✨

    No code suggestions found for the PR.

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

    @harsha509 harsha509 merged commit a039da8 into SeleniumHQ:trunk Oct 7, 2024
    3 checks passed
    selenium-ci added a commit that referenced this pull request Oct 7, 2024
    …guages (programming languages and spoken languages) (#1982) [deploy site]
    
    Edit code reference (L18->L19) to align Python example with others
    
    On page
    https://www.selenium.dev/documentation/webdriver/getting_started/first_script/
    in section "7. Request element information"
    Python example shows getting message element
    ```python3
    message = driver.find_element(by=By.ID, value="message")
    ```
    instead of getting message element information
    ```python3
    text = message.text
    ```
    
    The examples for other programming languages show getting the `text` attribute
    of the `message` element. And the examples for Python in other spoken
    languages show getting the `text` attribute of the `message` element.
    
    This commit changes the code reference to the Python file from L18 to
    L19 in the English markdown file.
    This makes the Python example show getting the `text` attribute from the
    `message` element.
    After this change:
    - the Python example is like the examples for other programming
    languages
    - the Python example on first_script.en.md is like the Python example
    for these: first_script.{zh-cn,pt-br,ja}.md a039da8
    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.

    2 participants