-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[🐛 Bug]: IWebElement.GetDomProperty("style") returns "System.Collections.Generic.Dictionary`2[System.String,System.Object]" (as string) #14846
Comments
@Mek7, 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! |
For maintainers: GetDomProperty: var style = element.GetDomProperty("style");
Console.WriteLine(style); // System.Object[]
GetDomAttribute: var style = element.GetDomAttribute("style");
Console.WriteLine(style); // height:20px;line-height:20px;width:20px
I thought I broke it recently, but no, the same behavior using "old" selenium versions. For @Mek7, seems in your case it is better to use DomAttribute? In any case string representation of |
Yes, GetDomAttribute() works OK but GetDomProperty() returns the ToString() result of a dictionary. |
It seems we have a similar issue with java. |
Moves us towards immutability of the Response type. Eventually, we may be able to remove the setters from some values, but that's not crucial. This also moves us towards aspirational goals of storing a JsonNode for the Value alongside the de-serialized object, which would help with bugs such as #14846 and many others involving incorrect de-serialization, especially with .ToString() invocations on dictionaries/lists, and as casts when the type is not a match. --------- Co-authored-by: Nikolay Borisenko <[email protected]>
What happened?
I am upgrading Selenium test code in .NET 8 from Selenium.Support version 4.25.0 to 4.27.0
Because IWebElement.GetAttribute() method is now marked as deprecated, I replaced it with GetDomProperty().
For example:
webDriver.FindElement(By....whatever).GetDomProperty("style")
should return a string like
background: rgb(65, 131, 215); height: 8.125%;
but returns this string:
System.Collections.Generic.Dictionary
2[System.String,System.Object]`Looks like a bug - that string is the string representation of calling .ToString() on a Dictionary instance.
Or is it supposed to work like this?
When I use GetDomAttribute() instead of GetDomProperty(), the correct string is returned:
background: rgb(65, 131, 215); height: 8.125%;
How can we reproduce the issue?
Relevant log output
Operating System
Windows 11
Selenium version
.NET 4.27.0
What are the browser(s) and version(s) where you see this issue?
Firefox 132.0.2
What are the browser driver(s) and version(s) where you see this issue?
GeckoDriver 0.35.0
Are you using Selenium Grid?
no
The text was updated successfully, but these errors were encountered: