HtmlElement.Net
Public Member Functions | Properties | List of all members
HtmlElements.Elements.HtmlSelect Class Reference

Models HTML select element and provides access to it's options More...

Inherits HtmlElements.Elements.HtmlControl, and IList< HtmlSelectOption >.

Public Member Functions

 HtmlSelect (IWebElement webElement)
 Initializes new instance of HTML element by calling base class constructor More...
 
void RemoveAt (int index)
 Not supported. Calling it will trigger System.NotSupportedException. More...
 
void Insert (int index, HtmlSelectOption item)
 Not supported. Calling it will trigger System.NotSupportedException. More...
 
int IndexOf (HtmlSelectOption item)
 Determines the index of a specific option among other select options. More...
 
bool Remove (HtmlSelectOption item)
 Not supported. Calling it will trigger System.NotSupportedException. More...
 
void CopyTo (HtmlSelectOption[] array, int arrayIndex)
 Copies select element options to an System.Array, starting at a particular System.Array index. More...
 
bool Contains (HtmlSelectOption item)
 Determines whether the select element contains a specific option. More...
 
void Add (HtmlSelectOption item)
 Not supported. Calling it will trigger System.NotSupportedException. More...
 
IEnumerator< HtmlSelectOptionGetEnumerator ()
 Returns an enumerator that iterates through select options. More...
 
void SelectByText (string text)
 Select all options by the text displayed. More...
 
void SelectByValue (string value)
 Select an option by the value. More...
 
void DeselectAll ()
 Clear all selected entries. This is only valid when the SELECT supports multiple selections. More...
 
void DeselectByText (string text)
 Deselect the option by the text displayed. More...
 
void DeselectByValue (string value)
 Deselect the option having value matching the specified text. More...
 
- Public Member Functions inherited from HtmlElements.Elements.HtmlElement
 HtmlElement (IWebElement webElement)
 
void Clear ()
 Clears the content of this element. More...
 
void SendKeys (string text)
 Simulates typing text into the element. More...
 
void Submit ()
 Submits this element to the web server. More...
 
void Click ()
 Clicks this element. More...
 
string GetAttribute (string attributeName)
 Gets the value of the specified attribute for this element. More...
 
string GetProperty (string propertyName)
 Gets the value of a JavaScript property of this element. More...
 
string GetCssValue (string propertyName)
 Gets the value of a CSS property of this element. More...
 
void EnterText (string text)
 Replace existing text input with provided. More...
 
TPage Open< TPage > ()
 Clicks on a wrapped WebElement and creates new page object instance of given type. More...
 
TPage OpenInNewWindow< TPage > ()
 Clicks on wrapped WebElement, waits until new window is opened and switches to it. More...
 
- Public Member Functions inherited from HtmlElements.WebDriverWrapper
object ExecuteScript (string script, params object[] args)
 Executes JavaScript in the context of the currently selected frame or window. More...
 
object ExecuteAsyncScript (string script, params object[] args)
 Executes JavaScript asynchronously in the context of the currently selected frame or window. More...
 
ReadOnlyCollection< IWebElement > FindElements (By @by)
 Finds all IWebElements within the current context using the given mechanism. More...
 
IWebElement FindElement (By @by)
 Finds the first T:OpenQA.Selenium.IWebElement using the given method. More...
 
TElement FindElement< TElement > (By @by)
 Finds the first IWebElement using given method and creates a page object of given type wrapping the element. More...
 
IList< TElement > FindElements< TElement > (By @by)
 Finds all IWebElements within the current context using the given mechanism and creates page objects wrapping it. More...
 
override string ToString ()
 Describes actual page object type and wrapped search context. More...
 

Properties

bool IsMultiple [get]
 Gets a value indicating whether select element supports multiple selections. More...
 
IList< HtmlSelectOptionOptions [get]
 Gets the list of options for the select element. More...
 
HtmlSelectOption SelectedOption [get]
 Gets the selected item within the select element. If more than one item is selected this will return the first item. More...
 
IList< HtmlSelectOptionSelectedOptions [get]
 Gets all of the selected options within the select element More...
 
HtmlSelectOption this[int index] [get, set]
 Gets select option at the specified index. Using setter will trigger System.NotSupportedException More...
 
bool IsReadOnly [get]
 Always returns truesince list is read-only More...
 
int Count [get]
 Gets the number of options contained in select element. More...
 
- Properties inherited from HtmlElements.Elements.HtmlControl
bool Disabled [get, set]
 Disabled/enabled control state More...
 
string Value [get, set]
 Value assigned to control More...
 
- Properties inherited from HtmlElements.Elements.HtmlElement
string Class [get, set]
 Gets or sets 'class' attribute of the underlying DOM element or null if it does not exist More...
 
IWebElement FirstChild [get]
 First child node of the web element, as a web element More...
 
string Id [get, set]
 Gets or sets 'id' attribute of the underlying DOM element or null if it does not exist More...
 
string InnerHtml [get, set]
 HTML content of an element More...
 
IWebElement LastChild [get]
 Last child node of the current element, as a web element More...
 
string Name [get, set]
 Gets or sets 'name' attribute of the underlying DOM element or null if it does not exist More...
 
IWebElement NextSibling [get]
 The next node of current web element, in the same tree level More...
 
IWebElement ParentNode [get]
 A WebElement, representing the parent node of current element, or null if it has no parent More...
 
IWebElement PreviousSibling [get]
 A previous node of current web element, in the same tree level More...
 
string Style [get, set]
 Gets or sets 'style' attribute of the underlying DOM element or null if it does not exist More...
 
string TextContent [get, set]
 Returns or sets the text from the element. On returning text, this property returns the value of all text nodes within the element node. On setting text, this property removes all child nodes and replaces them with a single text node. More...
 
string Title [get, set]
 Gets or sets 'title' attribute of the underlying DOM element or null if it does not exist More...
 
IWebElement WrappedElement [get]
 Returns underlying web element wrapped by current HtmlElement More...
 
string TagName [get]
 Gets the tag name of this element. More...
 
string Text [get]
 Gets the innerText of this element, without any leading or trailing whitespace, and with other whitespace collapsed. More...
 
bool Enabled [get]
 Gets a value indicating whether or not this element is enabled. More...
 
bool Selected [get]
 Gets a value indicating whether or not this element is selected. More...
 
Point Location [get]
 Gets a Point object containing the coordinates of the upper-left corner of this element relative to the upper-left corner of the page. More...
 
Size Size [get]
 Gets object containing the height and width of this element. More...
 
bool Displayed [get]
 Gets a value indicating whether or not this element is displayed. More...
 
- Properties inherited from HtmlElements.WebDriverWrapper
IPageObjectFactory PageObjectFactory [get]
 Gets the page object factory used to initialize current page object instance. More...
 
IWebDriver WrappedDriver [get]
 Gets the T:OpenQA.Selenium.IWebDriver wrapped by current page object instance. More...
 

Additional Inherited Members

- Protected Member Functions inherited from HtmlElements.Elements.HtmlControl
 HtmlControl (IWebElement webElement)
 Initializes new instance of HTML element by calling base class constructor More...
 
- Protected Member Functions inherited from HtmlElements.WebDriverWrapper
 WebDriverWrapper (ISearchContext webDriverOrWrapper)
 Initializes wrapper converting provided object to WebDriver More...
 

Detailed Description

Models HTML select element and provides access to it's options

Constructor & Destructor Documentation

◆ HtmlSelect()

HtmlElements.Elements.HtmlSelect.HtmlSelect ( IWebElement  webElement)

Initializes new instance of HTML element by calling base class constructor

Parameters
webElementWebElement wrapping WebDriver instance

Member Function Documentation

◆ Add()

void HtmlElements.Elements.HtmlSelect.Add ( HtmlSelectOption  item)

Not supported. Calling it will trigger System.NotSupportedException.

Exceptions
System.NotSupportedExceptionThrown on any attempt to use method.

◆ Contains()

bool HtmlElements.Elements.HtmlSelect.Contains ( HtmlSelectOption  item)

Determines whether the select element contains a specific option.

Parameters
item
Returns

◆ CopyTo()

void HtmlElements.Elements.HtmlSelect.CopyTo ( HtmlSelectOption[]  array,
int  arrayIndex 
)

Copies select element options to an System.Array, starting at a particular System.Array index.

Parameters
arrayThe one-dimensional System.Array that is the destination of the copied select options. The System.Array must have zero-based indexing.
arrayIndexThe zero-based index in array at which copying begins.

◆ DeselectAll()

void HtmlElements.Elements.HtmlSelect.DeselectAll ( )

Clear all selected entries. This is only valid when the SELECT supports multiple selections.

Exceptions
OpenQA.Selenium.WebDriverExceptionThrown when attempting to deselect all options from a SELECT that does not support multiple selections.

◆ DeselectByText()

void HtmlElements.Elements.HtmlSelect.DeselectByText ( string  text)

Deselect the option by the text displayed.

Parameters
textThe text of the option to be deselected.

◆ DeselectByValue()

void HtmlElements.Elements.HtmlSelect.DeselectByValue ( string  value)

Deselect the option having value matching the specified text.

Parameters
valueThe value of the option to deselect.

◆ GetEnumerator()

IEnumerator<HtmlSelectOption> HtmlElements.Elements.HtmlSelect.GetEnumerator ( )

Returns an enumerator that iterates through select options.

Returns
A System.Collections.Generic.IEnumerator<T> that can be used to iterate through select options.

◆ IndexOf()

int HtmlElements.Elements.HtmlSelect.IndexOf ( HtmlSelectOption  item)

Determines the index of a specific option among other select options.

Parameters
itemThe options to locate in select element.
Returns
The index of item if found; otherwise, -1.

◆ Insert()

void HtmlElements.Elements.HtmlSelect.Insert ( int  index,
HtmlSelectOption  item 
)

Not supported. Calling it will trigger System.NotSupportedException.

Exceptions
System.NotSupportedExceptionThrown on any attempt to use method.

◆ Remove()

bool HtmlElements.Elements.HtmlSelect.Remove ( HtmlSelectOption  item)

Not supported. Calling it will trigger System.NotSupportedException.

Exceptions
System.NotSupportedExceptionThrown on any attempt to use method.

◆ RemoveAt()

void HtmlElements.Elements.HtmlSelect.RemoveAt ( int  index)

Not supported. Calling it will trigger System.NotSupportedException.

Exceptions
System.NotSupportedExceptionThrown on any attempt to use method.

◆ SelectByText()

void HtmlElements.Elements.HtmlSelect.SelectByText ( string  text)

Select all options by the text displayed.

Parameters
textThe text of the option to be selected. If an exact match is not found, this method will perform a substring match.

◆ SelectByValue()

void HtmlElements.Elements.HtmlSelect.SelectByValue ( string  value)

Select an option by the value.

Parameters
valueThe value of the option to be selected.

Property Documentation

◆ Count

int HtmlElements.Elements.HtmlSelect.Count
get

Gets the number of options contained in select element.

◆ IsMultiple

bool HtmlElements.Elements.HtmlSelect.IsMultiple
get

Gets a value indicating whether select element supports multiple selections.

◆ IsReadOnly

bool HtmlElements.Elements.HtmlSelect.IsReadOnly
get

Always returns truesince list is read-only

◆ Options

IList<HtmlSelectOption> HtmlElements.Elements.HtmlSelect.Options
get

Gets the list of options for the select element.

◆ SelectedOption

HtmlSelectOption HtmlElements.Elements.HtmlSelect.SelectedOption
get

Gets the selected item within the select element. If more than one item is selected this will return the first item.

Exceptions
OpenQA.Selenium.NoSuchElementExceptionThrown if no option is selected.

◆ SelectedOptions

IList<HtmlSelectOption> HtmlElements.Elements.HtmlSelect.SelectedOptions
get

Gets all of the selected options within the select element

◆ this[int index]

HtmlSelectOption HtmlElements.Elements.HtmlSelect.this[int index]
getset

Gets select option at the specified index. Using setter will trigger System.NotSupportedException

Parameters
indexThe zero-based index of the select option to get.
Returns
The select option at the specified index.
Exceptions
NotSupportedExceptionThrown when attempted to set property value.