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)
| 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 <select> 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. |
nothing calls this directly
no test coverage detected