MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / GetCssValue

Method GetCssValue

dotnet/src/webdriver/WebElement.cs:530–540  ·  view source on GitHub ↗

Gets the value of a CSS property of this element. The name of the CSS property to get the value of. The value of the specified CSS property. The value returned by the method is likely to be unpredictable in a cross-browser environment. Color values should be returned as hex strings. For ex

(string propertyName)

Source from the content-addressed store, hash-verified

528 /// return "#008000" for its value.</remarks>
529 /// <exception cref="StaleElementReferenceException">Thrown when the target element is no longer valid in the document DOM.</exception>
530 public virtual string GetCssValue(string propertyName)
531 {
532 Dictionary<string, object> parameters = new Dictionary<string, object>();
533 parameters.Add("id", this.Id);
534 parameters.Add("name", propertyName);
535
536 Response commandResponse = this.Execute(DriverCommand.GetElementValueOfCssProperty, parameters);
537
538 commandResponse.EnsureValueIsNotNull();
539 return commandResponse.Value.ToString()!;
540 }
541
542 /// <summary>
543 /// Gets a <see cref="Screenshot"/> object representing the image of this element on the screen.

Callers

nothing calls this directly

Calls 4

ExecuteMethod · 0.95
EnsureValueIsNotNullMethod · 0.80
AddMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected