public static ISelector GetSelector(ExtractBy extractBy)
 {
     string value = extractBy.Value;
     ISelector selector;
     switch (extractBy.Type)
     {
         case ExtractBy.ExtracType.Css:
             selector = new CssSelector(value);
             break;
         case ExtractBy.ExtracType.Regex:
             selector = new RegexSelector(value);
             break;
         case ExtractBy.ExtracType.XPath:
             selector = GetXpathSelector(value);
             break;
         case ExtractBy.ExtracType.JsonPath:
             selector = new JsonPathSelector(value);
             break;
         case ExtractBy.ExtracType.Enviroment:
             selector = new EnviromentSelector(value);
             break;
         default:
             selector = GetXpathSelector(value);
             break;
     }
     return selector;
 }
 public void TestRegexWithLeftBracketQuoted()
 {
     string regex = "\\(.+";
     string source = "(hello world";
     RegexSelector regexSelector = new RegexSelector(regex);
     string select = regexSelector.Select(source);
     Assert.AreEqual(select, source);
 }
        public ISelectable Regex(string regex, int group)
        {
            RegexSelector regexSelector = Selectors.Regex(regex, group);

            return(Select(regexSelector));
        }
        public ISelectable Regex(string regex)
        {
            RegexSelector regexSelector = Selectors.Regex(regex);

            return(Select(regexSelector));
        }
Exemple #5
0
		public ISelectable Regex(string regex, int group)
		{
			RegexSelector regexSelector = Selectors.Regex(regex, group);
			return SelectList(regexSelector, GetSourceTexts());
		}