/// <summary> /// Finds all OpenQA.Selenium.IWebElement within the current context using the given /// mechanism. /// </summary> /// <param name="by">The locating mechanism to use.</param> /// <returns> A collections of all <see cref="IWebElement"/> matching the current criteria, or an empty list if nothing matches.</returns> public ReadOnlyCollection <IWebElement> FindElements(By by) { try { return(MockWebElement.GetElements(this, by)); } catch (Exception e) when(e is NoSuchElementException) { var elements = new List <IWebElement>(); return(new ReadOnlyCollection <IWebElement>(elements)); } }
/// <summary> /// Finds the first OpenQA.Selenium.IWebElement using the given method. /// </summary> /// <param name="by">The locating mechanism to use.</param> /// <returns>The first matching OpenQA.Selenium.IWebElement on the current context.</returns> public IWebElement FindElement(By by) => MockWebElement.GetElement(this, by);