Skip to content

Conversation

carlpinto25
Copy link

@carlpinto25 carlpinto25 commented Oct 11, 2025

User description

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

This PR updates the Element Information documentation and examples to include the new Selenium 4.27+ methods:

getDomAttribute()

getDomProperty()

These methods provide a clearer distinction between HTML source attributes and live DOM properties.
The JavaScript example (information.spec.js) has been updated accordingly.

  • I have yet to add support for other languages — that will done in this PR.

Motivation and Context

fixes #2493

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, Enhancement


Description

  • Added new Selenium 4.27+ methods getDomAttribute() and getDomProperty()

  • Updated documentation to clarify attribute vs property distinction

  • Enhanced JavaScript test examples with new methods

  • Improved backward compatibility guidance for getAttribute()


Diagram Walkthrough

flowchart LR
  A["getAttribute() (legacy)"] --> B["getDomAttribute()"]
  A --> C["getDomProperty()"]
  B --> D["HTML source attributes"]
  C --> E["Live DOM properties"]
Loading

File Walkthrough

Relevant files
Enhancement
information.spec.js
Added new DOM attribute/property methods                                 

examples/javascript/test/elements/information.spec.js

  • Added getDomAttribute() method call with console logging
  • Added getDomProperty() method call with console logging
  • Added comments explaining Selenium 4.27+ new methods
+9/-0     
Documentation
information.en.md
Enhanced attribute/property documentation                               

website_and_docs/content/documentation/webdriver/elements/information.en.md

  • Updated section title and description for attribute/property fetching
  • Added explanation of attribute vs property differences
  • Noted backward compatibility and performance considerations
  • Updated JavaScript code block reference to include new methods
+6/-4     

Copy link

netlify bot commented Oct 11, 2025

👷 Deploy request for selenium-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 766d133

@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.

Copy link
Contributor

qodo-merge-pro bot commented Oct 11, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Information leakage via logs

Description: Console logging of DOM attribute/property values may expose sensitive information in test
logs if run against real user inputs; consider removing or guarding logs.
information.spec.js [64-68]

Referred Code
console.log("DOM Attribute:", domAttribute);

// fetches the live property value from the DOM object (may differ at runtime)
const domProperty = await emailElement.getDomProperty("name");
console.log("DOM Property:", domProperty);
Ticket Compliance
🟢
🎫 #2493
🟢 Update the Information section of WebDriver elements docs to include new methods
getDomAttribute() and getDomProperty().
Clarify the distinction between HTML attributes and live DOM properties in the docs.
Update code examples to demonstrate usage of getDomAttribute() and getDomProperty().
Ensure JavaScript examples reflect the new methods.
Maintain backward compatibility guidance regarding getAttribute().
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

Copy link
Contributor

qodo-merge-pro bot commented Oct 11, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Update examples for all languages

The PR only updates the JavaScript code example for the new methods. To ensure
documentation consistency, add corresponding examples for all other supported
languages (Java, Python, C#, Ruby, Kotlin).

Examples:

website_and_docs/content/documentation/webdriver/elements/information.en.md [262-285]
{{< tabpane langEqualsHeader=true >}}
{{< tab header="Java" text=true >}}
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L60-L64" >}}
{{< /tab >}}
  {{< tab header="Python" text=true >}}
{{< gh-codeblock path="/examples/python/tests/elements/test_information.py#L44-L46" >}}
  {{< /tab >}}
{{< tab header="CSharp" text=true >}}
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L62" >}}
{{< /tab >}}

 ... (clipped 14 lines)

Solution Walkthrough:

Before:

// In website_and_docs/content/documentation/webdriver/elements/information.en.md
{{< tabpane langEqualsHeader=true >}}
  {{< tab header="Java" >}}
    {{< gh-codeblock path=".../InformationTest.java#L60-L64" >}} // Points to old example
  {{< /tab >}}
  {{< tab header="Python" >}}
    {{< gh-codeblock path=".../test_information.py#L44-L46" >}} // Points to old example
  {{< /tab >}}
  // ... other languages with old examples
  {{< tab header="JavaScript" >}}
    {{< gh-codeblock path=".../information.spec.js#L55-L68">}} // Points to new example
  {{< /tab >}}
  {{< tab header="Kotlin" >}}
    // ... old inline example using getAttribute()
  {{< /tab >}}
{{< /tabpane >}}

After:

// In website_and_docs/content/documentation/webdriver/elements/information.en.md
{{< tabpane langEqualsHeader=true >}}
  {{< tab header="Java" >}}
    // Path points to new example using getDomAttribute/getDomProperty
  {{< /tab >}}
  {{< tab header="Python" >}}
    // Path points to new example using get_dom_attribute/get_dom_property
  {{< /tab >}}
  // ... other languages with new examples
  {{< tab header="JavaScript" >}}
    {{< gh-codeblock path=".../information.spec.js#L55-L68">}} // Points to new example
  {{< /tab >}}
  {{< tab header="Kotlin" >}}
    // ... new inline example using getDomAttribute/getDomProperty
  {{< /tab >}}
{{< /tabpane >}}
Suggestion importance[1-10]: 9

__

Why: This suggestion correctly identifies a critical omission; the PR's goal is to document new methods, but it fails to provide examples for most supported languages, making the documentation inconsistent and incomplete.

High
Possible issue
Add assertions for new methods

Add assertions for the domAttribute and domProperty variables to verify that the
new getDomAttribute and getDomProperty methods return the correct values.

examples/javascript/test/elements/information.spec.js [61-70]

 // New in Selenium 4.27+
 // fetches the DOM attribute exactly as written in the HTML source
 const domAttribute = await emailElement.getDomAttribute("name");
 console.log("DOM Attribute:", domAttribute);
 
 // fetches the live property value from the DOM object (may differ at runtime)
 const domProperty = await emailElement.getDomProperty("name");
 console.log("DOM Property:", domProperty);
 
 assert.equal(nameAttribute, "email_input")
+assert.equal(domAttribute, "email_input")
+assert.equal(domProperty, "email_input")
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly points out that the new test code lacks assertions, which are essential for a test case to validate functionality, thus improving the test's quality.

Medium
  • Update

@carlpinto25
Copy link
Author

This update currently covers the JavaScript example and English documentation.
I’ll be adding updates for other languages ,if there are any differences or required changes i will work on it .

@pallavigitwork
Copy link
Member

@harsha509 will need to review , the javascript example workflows are failing.

@carlpinto25
Copy link
Author

updated other languages except for ruby

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.

[🚀 Feature]: Update Information section with new methods to fetch Dom attributes

3 participants