ClassTreeCrawler<T, V, R>
Crawls an element hierarchy tree.
Definition
Namespace:ArtOfTest.Common
Assembly:ArtOfTest.WebAii.dll
Type Parameters:
T
The target element type
V
The FindExpression type
R
The FindClause type
Syntax:
public abstract class TreeCrawler<T, V, R> where T : ITargetElement where V : IFindExpression where R : FindClause
Inheritance: objectTreeCrawler<T, V, R>
Derived Classes:
Constructors
TreeCrawler()
Declaration
protected TreeCrawler()
Properties
LastUsedExpression
The last FindExpression used by this Crawler.
Declaration
public V LastUsedExpression { get; protected set; }
Property Value
V
SearchRoot
Gets the SearchRoot for this crawler.
Declaration
public virtual T SearchRoot { get; }
Property Value
T
Methods
AllByCustom(T, Predicate<T>, bool)
Find all matches that match custom search logic
AllByExpression(T, V)
Finds all the elements in the tree that match the find expression.
Declaration
public virtual IList<T> AllByExpression(T startNode, V expression)
Parameters
startNode
T
The root node of the tree to search.
expression
V
The find expression.
Returns
IList<T>
A list of all elements that match the expression or an empty list if nothing is found.
AllByExpression(V)
Finds all the elements in the tree that match the find expression.
Declaration
public virtual IList<T> AllByExpression(V expression)
Parameters
expression
V
The find expression.
Returns
IList<T>
A list of all elements that match the expression or an empty list if nothing is found.
Remarks
Uses this.SearchRoot as the search root
ByCustom(T, Predicate<T>, bool)
Find using custom logic.
ByExpression(T, V)
Finds the first element in the tree that matches the find expression.
Declaration
public virtual T ByExpression(T startNode, V expression)
Parameters
startNode
T
The root node of the tree to search.
expression
V
The find expression.
Returns
T
The first element it finds else null.
Remarks
This overload does not include the root node in the search.
ByExpression(T, V, bool)
Finds the first element in the tree that matches the find expression.
Declaration
public virtual T ByExpression(T startNode, V expression, bool includeRoot)
Parameters
startNode
T
The root node of the tree to search.
expression
V
The find expression.
includeRoot
Whether to include the root node in the search.
Returns
T
The first element it finds, else null.
ByExpression(V)
Finds the first element in the tree that matches the find expression.
Declaration
public virtual T ByExpression(V expression)
Parameters
expression
V
The find expression.
Returns
T
The first element it finds else null.
Remarks
This overload does not include the root node in the search.
ByExpression(V, bool)
Finds the first element in the tree that matches the find expression.
Declaration
public virtual T ByExpression(V expression, bool includeRoot)
Parameters
expression
V
The find expression.
includeRoot
Whether to include the root node in the search
Returns
T
The first element it finds else null.
Remarks
Uses this.SearchRoot as the search root
FindAllUsingHierarchicalClause(T, R)
Find all nodes using a hierarchical clause (XPATH, TagIndex...etc)
Declaration
public abstract IEnumerable<T> FindAllUsingHierarchicalClause(T startNode, R clause)
Parameters
startNode
T
The node to start with.
clause
R
The clause to use
Returns
IEnumerable<T>
The found elements else null;
FindUsingExpressionPath(T, string, out T)
Find an element using expression paths starting at startNode.
Declaration
public T FindUsingExpressionPath(T startNode, string expPath, out T failureLocation)
Parameters
startNode
T
The start node.
expPath
The expression path
failureLocation
T
In case it didn't find a target, will return the failure location in the tree, where the search stopped
Returns
T
The found node, else null.
FindUsingHierarchicalClause(T, R)
Find a node using a hierarchical clause (XPATH, TagIndex...etc)
Declaration
public abstract T FindUsingHierarchicalClause(T startNode, R clause)
Parameters
startNode
T
The node to start with.
clause
R
The clause to use
Returns
T
The found element else null;