Class
TreeCrawler<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:

cs-api-definition
public abstract class TreeCrawler<T, V, R> where T : ITargetElement where V : IFindExpression where R : FindClause

Inheritance: objectTreeCrawler<T, V, R>

Derived Classes: VisualFind

Constructors

TreeCrawler()

Declaration

cs-api-definition
protected TreeCrawler()

Properties

LastUsedExpression

The last FindExpression used by this Crawler.

Declaration

cs-api-definition
public V LastUsedExpression { get; protected set; }

Property Value

V

SearchRoot

Gets the SearchRoot for this crawler.

Declaration

cs-api-definition
public virtual T SearchRoot { get; }

Property Value

T

Methods

AllByCustom(T, Predicate<T>, bool)

Find all matches that match custom search logic

Declaration

cs-api-definition
public virtual IList<T> AllByCustom(T startNode, Predicate<T> customLogic, bool includeRoot)

Parameters

startNode

T

The start node of the search

customLogic

Predicate<T>

The custom logic to use

includeRoot

bool

Whether to include the root or not.

Returns

IList<T>

AllByExpression(T, V)

Finds all the elements in the tree that match the find expression.

Declaration

cs-api-definition
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

cs-api-definition
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.

Declaration

cs-api-definition
public virtual T ByCustom(T startNode, Predicate<T> customLogic, bool includeRoot)

Parameters

startNode

T

The start node.

customLogic

Predicate<T>

Custom predicate.

includeRoot

bool

True/False whether to search the root node.

Returns

T

The found element else null.

ByExpression(T, V)

Finds the first element in the tree that matches the find expression.

Declaration

cs-api-definition
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

cs-api-definition
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

bool

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

cs-api-definition
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

cs-api-definition
public virtual T ByExpression(V expression, bool includeRoot)

Parameters

expression

V

The find expression.

includeRoot

bool

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

cs-api-definition
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

cs-api-definition
public T FindUsingExpressionPath(T startNode, string expPath, out T failureLocation)

Parameters

startNode

T

The start node.

expPath

string

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

cs-api-definition
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;