コード例 #1
0
 public IsElementIdentifierUniqueRequest(string identifier, ElementIdentifierType type)
 {
     Handled    = false;
     IsUnique   = false;
     Identifier = identifier;
     Type       = type;
 }
コード例 #2
0
 public static bool IsElementPresent(ElementIdentifierType elementIdentifierType, string locatorPath)
 {
     try
     {
         GetWebElement(elementIdentifierType, locatorPath);
         return(true);
     }
     catch (NoSuchElementException e)
     {
         return(false);
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public static void ClickElement(ElementIdentifierType elementIdentifierType, string locatorPath)
 {
     GetWebElement(elementIdentifierType, locatorPath).Click();
 }
コード例 #5
0
 public static void SendText(ElementIdentifierType elementIdentifierType, string locatorPath, string value)
 {
     GetWebElement(elementIdentifierType, locatorPath).SendKeys(value);
 }
コード例 #6
0
 public static string GetTextOfElement(ElementIdentifierType elementIdentifierType, string locatorPath)
 {
     return(GetWebElement(elementIdentifierType, locatorPath).Text);
 }