/// <summary> /// If the element is selectable, gets the options count /// </summary> /// <returns>An integer value. Otherwise, NULL.</returns> public static int?GetSelectOptionsCount(this IWebElement element) { if (!element.IsSelectable()) { return(null); } return(element.AsSelectable().Options.Count); }
public static void SelectByIndex(this IWebElement element, int index) { if (!element.IsSelectable()) { return; } element.AsSelectable().SelectByIndex(index); }
/// <summary> /// If the element is selectable, gets the selected option /// </summary> /// <returns>A <see cref="IWebElement"/> element that represents the selected option</returns> public static IWebElement GetSelectedOption(this IWebElement element) { if (!element.IsSelectable()) { return(null); } return(element.AsSelectable().SelectedOption); }
/// <summary> /// If the element is selectable, selects the option's item by text /// </summary> /// <param name="text">The text to select</param> public static void SelectByText(this IWebElement element, string text) { if (!element.IsSelectable()) { return; } element.AsSelectable().SelectByText(text); }
public static IEnumerable <string> GetSelectOptionsAsEnumerable(this IWebElement element) { if (!element.IsSelectable()) { return(null); } var options = element.AsSelectable().Options.Select(item => item.Text); return(options); }