-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[🚀 Feature]: deprecate WebElement.getAttribute #13334
Comments
@joerg1985, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
Bold. I'm not completely against the idea, but also not sure it's the right call. |
Let me ask, are the 3 APIs above different? |
The ideal world people figure out if they want an attribute or property and use the correct method. But that might be asking a lot of users, and we already have the code right there... |
I was reading the blog post and the javadoc before opening the issue, this gave me the feeling the getAttribute method is the legacy way of reading attributes/properties. If this is not true and there are no plans to ever remove the getAttribute method, this issue can be closed. If this is a legacy method, it might be good to mark it deprecated or make a clear statement in the docs to ensure no new code is using this. |
It would definitely be valuable to encourage people to use the other methods. |
We decided in TLC Meeting 1/18 that we would go ahead and mark this feature deprecated to encourage people to move to the more precise property and attribute methods. We need a blog post explaining everything though, and I'm still not sure we want to actually remove it any time soon because it is quite useful. |
This issue is stale because it has been open 280 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
Are we still doing this? |
I hope so, i think this is still a valid point. |
I can make a PR to deprecate |
It is still valid, just that no one has worked on it. Thank you for offering, @Delta456! |
I will PR the deprecation but for the blog I will need your help @diemol and others. |
I just noticed something strage, which is probably the root for having This is a important point to the blog post in my mind. |
Across all language bindings the method has been deprecated. We now need to work on a blog post. I am up to volunteer for this. |
If we are now going to ask users to do this #13334 (comment), then I think I am changing my mind, even if it was a TLC decision. We should be helping users and not asking them to do more. I am not sure what the real benefit of getting rid of this method is. |
Is there a blog post explaining how to migrate from |
@canon-cmre-benoit-lecardonnel There is no new blog post regarding the deprecation yet, but there is still the Selenium 4 - Element Attribute and Property Methods available. |
Thanks @joerg1985 - This is a very useful page. |
dears, |
The difference I noticed is getDomAttribute()- Returns the attribute value exactly as written in HTML. e.g:getDomAttribute Key Point: Reflects the current state of the element, including any changes made during execution.(In html whatever we make change in runtime that wont reflect it will display the same value only) getDomProperty: getDomAttribute(): Static, from the HTML source. |
Feature and motivation
WebElement.getDomAttribute
andWebElement.getDomProperty
have been added in Selenium 4.It might be good to deprecate
WebElement.getAttribute
to remove it at a undefined time in the future.Usage example
This would warn people to move to the 'new' methods when maintaining existing code.
The text was updated successfully, but these errors were encountered: