SelectElement SelectByText Method WebDriver
Select all options by the text displayed.

Namespace: OpenQA.Selenium.Support.UI
Assembly: WebDriver.Support (in WebDriver.Support.dll) Version: 2.35.0.0 (2.35.0.0)
Syntax

public void SelectByText(
	string text
)

Parameters

text
Type: OnlineSystem String
The text of the option to be selected. If an exact match is not found, this method will perform a substring match.
Exceptions

ExceptionCondition
OpenQA.Selenium NoSuchElementExceptionThrown if there is no element with the given text present.
Remarks

When given "Bar" this method would select an option like:

<option value="foo">Bar</option>

See Also