Beispiel #1
0
        IWebElement findElement(string param, ByTypes byType)
        {
            By by = By.Id(param);

            switch (byType)
            {
            case ByTypes.Id:
                by = By.Id(param);
                break;

            case ByTypes.Name:
                by = By.Name(param);
                break;

            case ByTypes.ClassName:
                by = By.ClassName(param);
                break;

            case ByTypes.XPath:
                by = By.XPath(param);
                break;

            default:
                by = By.Id(param);
                break;
            }

            return(driver.FindElement(by));
        }
Beispiel #2
0
        bool exist(string param, ByTypes byType)
        {
            try
            {
                findElement(param, byType);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #3
0
 public static Func <string, By> GetByFunc(this By by)
 {
     return(ByTypes.FirstOrDefault(el => by.ToString().Contains(el.Key)).Value);
 }
Beispiel #4
0
        void sendKeys(string param, ByTypes byType, string value)
        {
            IWebElement element = findElement(param, byType);

            element.SendKeys(value);
        }
Beispiel #5
0
        void click(string param, ByTypes byType)
        {
            IWebElement element = findElement(param, byType);

            element.Click();
        }