protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { string[] conditionalXPathTerms = builder.Options.Terms. Where(x => (x.StartsWith("[") && x.EndsWith("]")) || x.StartsWith("@")). ToArray(); string[] conditionalXPathSelectors = conditionalXPathTerms. Select(x => x.StartsWith("@") ? x : x.Substring(1, x.Length - 2)). ToArray(); if (conditionalXPathSelectors.Length > 1) { conditionalXPathSelectors = conditionalXPathSelectors. Select(x => $"({x})"). ToArray(); } string conditionalXPath = conditionalXPathSelectors.Any() ? builder.WrapWithIndex(x => x.Descendant.ComponentXPath[y => y.JoinOr(conditionalXPathSelectors)]) : null; string[] outerXPathSelectors = builder.Options.Terms. Except(conditionalXPathTerms). Select(x => acceptableXPathPrefixValues.Any(prefix => x.StartsWith(prefix)) ? x : ".//" + x). ToArray(); string outerXPath = outerXPathSelectors.Any() ? builder.WrapWithIndex(x => x._($"({string.Join(" | ", outerXPathSelectors)})")).DescendantOrSelf.ComponentXPath : null; if (conditionalXPath != null && outerXPath != null) return $"(({outerXPath}) | ({conditionalXPath}))"; else return outerXPath ?? conditionalXPath; }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { string classCondition = GetClassCondition(options); return builder. WrapWithIndex(x => x.Descendant.Any[classCondition]). DescendantOrSelf.ComponentXPath; }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { string idCondition = string.IsNullOrWhiteSpace(options.IdXPathFormat) ? builder.TermsConditionOf("id") : builder.JoinOr(options.Terms.Select(term => options.IdXPathFormat.FormatWith(term))); return builder.WrapWithIndex(x => x.Descendant.Any[idCondition]).DescendantOrSelf.ComponentXPath; }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { string[] conditions = options.Terms.Length > 1 ? options.Terms.Select(x => $"({x})").ToArray() : options.Terms; return builder.WrapWithIndex(x => x.Descendant.ComponentXPath[y => y.JoinOr(conditions)]); }
public ComponentScopeLocateResult Find(IWebElement scope, ComponentScopeLocateOptions options, SearchOptions searchOptions) { ComponentScopeXPathBuilder builder = new ComponentScopeXPathBuilder(options); string xPath = builder. WrapWithIndex(x => x.OuterXPath.Any[y => y.TermsConditionOf("id")]). Self.ComponentXPath; return(new XPathComponentScopeFindResult(xPath, scope, searchOptions)); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder. WrapWithIndex(x => x.Descendant.Any[y => y.TermsConditionOf("id")]). DescendantOrSelf.ComponentXPath); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return builder. WrapWithIndex(x => x.Descendant.Any[y => y.TermsConditionOf("name")]). DescendantOrSelf.ComponentXPath; }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder. WrapWithIndex(x => x.OuterXPath.ComponentXPath[y => y.TermsConditionOf(attributeName)])); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder. WrapWithIndex(x => x.Descendant._("dl/dt")[y => y.TermsConditionOfContent]). FollowingSibling._("dd").DescendantOrSelf.ComponentXPath); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder. WrapWithIndex(x => x.OuterXPath.ComponentXPath[c => c.Descendant.Any[d => d.TermsConditionOf(_attributeName)]])); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return builder. WrapWithIndex(x => x.Descendant.ComponentXPath[y => y.TermsConditionOfContent]); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return builder.WrapWithIndex(options.Index.Value, x => x.Descendant.ComponentXPath); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return builder. WrapWithIndex(x => x.Descendant._("fieldset")[y => y._("legend")[z => z.TermsConditionOfContent]]). DescendantOrSelf.ComponentXPath; }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder.WrapWithIndex(options.Index.Value, x => x.OuterXPath.ComponentXPath)); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder. WrapWithIndex(x => x.Descendant._("fieldset")[y => y._("legend")[z => z.TermsConditionOfContent]]). DescendantOrSelf.ComponentXPath); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return builder. WrapWithIndex(x => x.Descendant._("dl/dt")[y => y.TermsConditionOfContent]). FollowingSibling._("dd").DescendantOrSelf.ComponentXPath; }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder. WrapWithIndex(x => x.OuterXPath._("td").WhereIndex(columnIndex).DescendantOrSelf.ComponentXPath)); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return builder. WrapWithIndex(x => x.Descendant._("td").WhereIndex(columnIndex).DescendantOrSelf.ComponentXPath); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder. WrapWithIndex(x => x.Descendant.ComponentXPath[y => y.TermsConditionOfContent.Or.TermsConditionOf("value")])); }
protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return(builder. WrapWithIndex(x => x.OuterXPath.ComponentXPath[y => y.Any[childIndex + 1][z => z.TermsConditionOfContent]])); }