/// <summary> /// Finds the element. /// </summary> /// <param name="type">The type.</param> /// <param name="pattern">The pattern.</param> private void FindElement(FindElementType type, string pattern) { switch (type) { case FindElementType.GetByClassName: elements = _driver.FindElementsByClassName(pattern).ToList(); break; case FindElementType.GetByXPath: elements = _driver.FindElementsByXPath(pattern).ToList(); break; case FindElementType.GetByTagName: elements = _driver.FindElementsByTagName(pattern).ToList(); break; case FindElementType.GetByCssSelector: elements = _driver.FindElementsByCssSelector(pattern).ToList(); break; case FindElementType.GetByLinkText: elements = _driver.FindElementsByLinkText(pattern).ToList(); break; case FindElementType.GetByName: elements = _driver.FindElementsByName(pattern).ToList(); break; default: elements = _driver.FindElementsByClassName(pattern).ToList(); break; } }
/// <summary> /// Gets the element. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> private void GetElement(FindElementType type, String pattern) { switch (type) { case FindElementType.GetById: _currentelement = _driver.FindElementById(pattern); break; case FindElementType.GetByClassName: _currentelement = _driver.FindElementByClassName(pattern); break; case FindElementType.GetByXPath: _currentelement = _driver.FindElementByXPath(pattern); break; case FindElementType.GetByTagName: _currentelement = _driver.FindElementByTagName(pattern); break; case FindElementType.GetByCssSelector: _currentelement = _driver.FindElementByCssSelector(pattern); break; case FindElementType.GetByLinkText: _currentelement = _driver.FindElementByLinkText(pattern); break; case FindElementType.GetByName: _currentelement = _driver.FindElementByName(pattern); break; case FindElementType.GetByPartialLinkText: _currentelement = _driver.FindElementByPartialLinkText(pattern); break; case FindElementType.GetByElementText: _currentelement = GetByElementText(pattern); break; default: _currentelement = _driver.FindElementById(pattern); break; } }
/// <summary> /// Finds from elements. /// </summary> /// <param name="type">The type.</param> /// <param name="pattern">The pattern.</param> private void FindFromElements(FindElementType type, string pattern) { switch (type) { case FindElementType.GetById: elements = _currentelement.FindElements(By.Id(pattern)).ToList(); break; case FindElementType.GetByClassName: elements = _currentelement.FindElements(By.ClassName(pattern)).ToList(); break; case FindElementType.GetByXPath: elements = _currentelement.FindElements(By.XPath(pattern)).ToList(); break; case FindElementType.GetByTagName: elements = _currentelement.FindElements(By.TagName(pattern)).ToList(); break; case FindElementType.GetByCssSelector: elements = _currentelement.FindElements(By.CssSelector(pattern)).ToList(); break; case FindElementType.GetByLinkText: elements = _currentelement.FindElements(By.LinkText(pattern)).ToList(); break; case FindElementType.GetByName: elements = _currentelement.FindElements(By.Name(pattern)).ToList(); break; case FindElementType.GetByPartialLinkText: elements = _currentelement.FindElements(By.PartialLinkText(pattern)).ToList(); break; default: break; } }