You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encourage users to move to WebElement.getDomAttribute and WebElement.getDomProperty methods
⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review
Missing Deprecation Message The @deprecated annotation should include a message explaining why the method is deprecated and suggesting alternative methods to use.
✅ Update method documentation to reflect its deprecated status and provide alternativesSuggestion Impact:The Javadoc was updated to mention the method's deprecated status and suggest alternative methods, aligning with the suggestion.
code diff:
+ * @deprecated This method is deprecated. Use {@link #getDomProperty(String)} or {@link+ * #getDomAttribute(String)} for more precise attribute retrieval.
Update the method's Javadoc to mention its deprecated status and suggest alternative methods to use.
/**
* <p>See <a href="https://w3c.github.io/webdriver/#get-element-attribute">W3C WebDriver
* specification</a> for more details.
*
* @param name The name of the attribute.
* @return The attribute/property's current value or null if the value is not set.
+ * @deprecated This method is deprecated. Use {@link #getProperty(String)} or {@link #getDomAttribute(String)} for more precise attribute retrieval.
*/
@Deprecated
@Nullable String getAttribute(String name);
Apply this suggestion
Suggestion importance[1-10]: 9
Why: Updating the Javadoc to mention the deprecation and suggest alternative methods enhances documentation quality, ensuring developers are informed about the change and can transition smoothly to recommended methods.
9
Best practice
Enhance the deprecation annotation with additional information to guide developers
Consider adding a reason for the deprecation in the @Deprecated annotation to provide more context for developers using this method.
-@Deprecated+@Deprecated(since = "4.x", forRemoval = true, reason = "Use getProperty() or getDomAttribute() for more precise attribute retrieval")
@Nullable String getAttribute(String name);
Apply this suggestion
Suggestion importance[1-10]: 8
Why: Adding a reason for deprecation in the @Deprecated annotation provides clarity and guidance for developers, improving code maintainability and usability by suggesting alternatives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Marks
WebElement.getAttributeas deprecatedMotivation and Context
Discussed in #13334
Types of changes
Checklist
PR Type
Enhancement
Description
WebElement.getAttributemethod by adding the@Deprecatedannotation.getDomAttributeandgetDomPropertymethods introduced in Selenium 4.getAttributein the future.Changes walkthrough 📝
WebElement.java
Deprecate `getAttribute` method in WebElement interfacejava/src/org/openqa/selenium/WebElement.java
getAttributemethod as deprecated.@Deprecatedannotation to thegetAttributemethod.