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

Method SelectElement

dotnet/src/support/UI/SelectElement.cs:37–56  ·  view source on GitHub ↗

Initializes a new instance of the class. The element to be wrapped Thrown when the object is Thrown when the element wrapped is not a <select> element.

(IWebElement element)

Source from the content-addressed store, hash-verified

35 /// <exception cref="ArgumentNullException">Thrown when the <see cref="IWebElement"/> object is <see langword="null"/></exception>
36 /// <exception cref="UnexpectedTagNameException">Thrown when the element wrapped is not a &lt;select&gt; element.</exception>
37 public SelectElement(IWebElement element)
38 {
39 if (element is null)
40 {
41 throw new ArgumentNullException(nameof(element), "element cannot be null");
42 }
43
44 string tagName = element.TagName;
45
46 if (string.IsNullOrEmpty(tagName) || !string.Equals(tagName, "select", StringComparison.OrdinalIgnoreCase))
47 {
48 throw new UnexpectedTagNameException("select", tagName);
49 }
50
51 this.WrappedElement = element;
52
53 // let check if it's a multiple
54 string? attribute = element.GetAttribute("multiple");
55 this.IsMultiple = attribute != null && !attribute.Equals("false", StringComparison.OrdinalIgnoreCase);
56 }
57
58 /// <summary>
59 /// Gets the <see cref="IWebElement"/> wrapped by this object.

Callers

nothing calls this directly

Calls 2

EqualsMethod · 0.45
GetAttributeMethod · 0.45

Tested by

no test coverage detected