Exemple #1
0
 public SCollectionFilteredWebElementsCollectionSLocator(
     Condition <SeleneElement> condition,
     SeleneCollection context,
     _SeleneSettings_ config
     )
 {
     this.condition = condition;
     this.context   = context;
     this.config    = config;
 }
Exemple #2
0
        public static SeleneCollection SS(string selector, IWebDriver driver)
        {
            selectorKind            = null;
            selectorValue           = null;
            seleneElementCollection = null;
            regex   = new Regex("^(?<kind>xpath|css|text) *= *(?<value>.*)$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            matches = regex.Matches(selector);
            foreach (Match match in matches)
            {
                if (match.Length != 0)
                {
                    foreach (Capture capture in match.Groups["kind"].Captures)
                    {
                        if (selectorKind == null)
                        {
                            selectorKind = capture.ToString();
                        }
                    }
                    foreach (Capture capture in match.Groups["value"].Captures)
                    {
                        if (selectorValue == null)
                        {
                            selectorValue = capture.ToString();
                        }
                    }
                }
            }
            if (selectorKind != null)
            {
                switch (selectorKind)
                {
                case "css":
                    seleneElementCollection = SS(By.CssSelector(selectorValue), driver);
                    break;

                case "xpath":
                    seleneElementCollection = SS(By.XPath(selectorValue), driver);
                    break;

                case "text":
                    String xpath = String.Format("//*[contains(text(),'{0}')]", selectorValue);
                    seleneElementCollection = SS(By.XPath(xpath), driver);
                    break;

                default:
                    seleneElementCollection = SS(By.CssSelector(selector), driver);
                    break;
                }
            }
            else
            {
                seleneElementCollection = SS(By.CssSelector(selector), driver);
            }
            return(seleneElementCollection);
        }
Exemple #3
0
 public SCollectionWebElementByIndexSLocator(int index, SeleneCollection context)
 {
     this.index   = index;
     this.context = context;
 }
Exemple #4
0
 public SCollectionFilteredWebElementsCollectionSLocator(Condition <SeleneElement> condition, SeleneCollection context, SeleneDriver driver)
 {
     this.condition = condition;
     this.context   = context;
     this.driver    = driver;
 }