/// <summary>Selects an option from a select box based on text /// <para> @param by - the by selector for the given element </para> /// <para> @param optionText - the text to select by </para> /// </summary> internal void SelectByText(By by, string optionText) { if (_logActions) { _logger.LogMessage(string.Format("Selct: {0}", optionText)); _logger.LogMessage(string.Format(" at: {0}", by)); } var select = new SelectElement(Find(by)); if (!select.Equals(null)) { try { select.SelectByText(optionText); } catch { var errMsg = String.Format( "PageObjectBase: There is no option '{0}' in {1}.", optionText, by); throw new InvalidSelectOptionException(errMsg); } } else { string errMsg = "Cannot find element " + by.ToString(); throw new NoSuchElementException(errMsg); } }