public IsElementIdentifierUniqueRequest(string identifier, ElementIdentifierType type) { Handled = false; IsUnique = false; Identifier = identifier; Type = type; }
public static bool IsElementPresent(ElementIdentifierType elementIdentifierType, string locatorPath) { try { GetWebElement(elementIdentifierType, locatorPath); return(true); } catch (NoSuchElementException e) { return(false); } }
public static IWebElement GetWebElement(ElementIdentifierType elementIdentifierType, string locatorPath) { switch (elementIdentifierType) { case ElementIdentifierType.Id: { return(CurrentDriver.FindElement(By.Id(locatorPath))); } case ElementIdentifierType.Name: { return(CurrentDriver.FindElement(By.Name(locatorPath))); } case ElementIdentifierType.Xpath: { return(CurrentDriver.FindElement(By.XPath(locatorPath))); } case ElementIdentifierType.CSS: { return(CurrentDriver.FindElement(By.CssSelector(locatorPath))); } case ElementIdentifierType.ClassName: { return(CurrentDriver.FindElement(By.ClassName(locatorPath))); } case ElementIdentifierType.TagName: { return(CurrentDriver.FindElement(By.TagName(locatorPath))); } case ElementIdentifierType.LinkText: { return(CurrentDriver.FindElement(By.LinkText(locatorPath))); } } return(null); }
public static void ClickElement(ElementIdentifierType elementIdentifierType, string locatorPath) { GetWebElement(elementIdentifierType, locatorPath).Click(); }
public static void SendText(ElementIdentifierType elementIdentifierType, string locatorPath, string value) { GetWebElement(elementIdentifierType, locatorPath).SendKeys(value); }
public static string GetTextOfElement(ElementIdentifierType elementIdentifierType, string locatorPath) { return(GetWebElement(elementIdentifierType, locatorPath).Text); }