Class
FindParam

A class that defines how a search for an element should be conducted within a document.

Definition

Namespace:ArtOfTest.WebAii.ObjectModel

Assembly:ArtOfTest.WebAii.dll

Syntax:

cs-api-definition
[Obsolete("FindParam will be removed in next release. Please use HtmlFindExpression or XamlFindExpressions instead. FindParam.ToFindExpression() can help you convert your current FindParams to FindExpressions")]
public class FindParam : INotifyPropertyChanged, IFindParam

Inheritance: objectFindParam

Implements: IFindParamINotifyPropertyChanged

Constructors

FindParam()

Create a new FindParam

Declaration

cs-api-definition
public FindParam()

FindParam(FindType, string, params string[])

Create a new FindParam by explicitly specifying the FindType.

Declaration

cs-api-definition
public FindParam(FindType type, string value, params string[] attributesNameValuePairs)

Parameters

type

FindType

The find type.

value

string

The value signifies the following depending on the type: Type=AttributesOnly:Value=(string.empty|tagName [When tagName is set, will match tagName in addition to attributes]),Type=NodeIndexPath:Value=(index path [i.e. "0/3/2/0"]), Type=XPath:Value=(xpath to use),Type=Content:Value=(content to use [i.e. "p:string"]) - default is FindContentType.TextContent, Type=TagIndex:Value(tagName:tagIndex [i.e. "input:3"])

attributesNameValuePairs

string[]

The attributes list, if any, else string.Empty.

FindParam(HtmlFindExpression)

Create a new find param of type.

Declaration

cs-api-definition
public FindParam(HtmlFindExpression expression)

Parameters

expression

HtmlFindExpression

FindParam(params int[])

Create a new find parameter of Type=NodeIndexPath

Declaration

cs-api-definition
public FindParam(params int[] nodesIndexPath)

Parameters

nodesIndexPath

int[]

The index path of the desired node

FindParam(params string[])

Create a new find parameter using name-value pairs of attributes.

Declaration

cs-api-definition
public FindParam(params string[] attributesNameValuePairs)

Parameters

attributesNameValuePairs

string[]

The name value pairs. Example ("id=foo","style=color:red"). Use '=' to indicate partial values.

FindParam(string, int)

Create a new find parameter of Type=TagIndex

Declaration

cs-api-definition
public FindParam(string tagName, int occurrenceIndex)

Parameters

tagName

string

The TagName to search for

occurrenceIndex

int

The occurrence index of the target tag (zero-based).

FindParam(string, int, params string[])

Create a new find parameter of Type=TagIndex with additional attributes to use to find the element or verify it.

Declaration

cs-api-definition
public FindParam(string tagName, int occurrenceIndex, params string[] attributesNameValuePairs)

Parameters

tagName

string

The TagName to search for.

occurrenceIndex

int

The occurrence index of the tag (Zero-Based).

attributesNameValuePairs

string[]

Any additional attributes to check for; both exact or partial

Properties

Attributes

Gets/Sets the list of Attributes to use for identification.

Declaration

cs-api-definition
[Browsable(false)]
public Collection<iAttribute> Attributes { get; set; }

Property Value

Collection<iAttribute>

Constraints

Gets or sets a constraint for this FindParam

Declaration

cs-api-definition
[Browsable(false)]
public FindParamConstraint[] Constraints { get; set; }

Property Value

FindParamConstraint[]

ContentType

Gets/Sets the content type when the identification type is Content. (Default:TextContent)

Declaration

cs-api-definition
public FindContentType ContentType { get; set; }

Property Value

FindContentType

ContentValue

Gets/Sets the content value to find when type is Content. This can be a string to validate against or a regular expression. The content must start with: 'l:' for exact match strings, 'p:' for partial strings or 'x:' for regular expression matches. If none are provided the string will be matched using an exact match 'l:'. All searches are case-insensitive.

To find tags with innerText content is: 'foo bar' Example 1: 'l:foo bar' Example 2: 'p:foo' Example 3: 'x:foo\s*bar'

Declaration

cs-api-definition
public string ContentValue { get; set; }

Property Value

string

ExcludedAttributes

Gets/Sets the list of attribute to exclude for identification.

Declaration

cs-api-definition
[Browsable(false)]
public Collection<iAttribute> ExcludedAttributes { get; set; }

Property Value

Collection<iAttribute>

Expression

The HtmlFindExpression used if Type=Expression.

Declaration

cs-api-definition
[Browsable(false)]
public HtmlFindExpression Expression { get; set; }

Property Value

HtmlFindExpression

NodeIndexPath

Gets/Sets Hierarchal path from the reference element when Type=NodeIndexPath.

Declaration

cs-api-definition
[Browsable(false)]
public string NodeIndexPath { get; set; }

Property Value

string

PartialAttributes

Gets/Sets the partial attribute values to use for identification.

Declaration

cs-api-definition
[Browsable(false)]
public Collection<iAttribute> PartialAttributes { get; set; }

Property Value

Collection<iAttribute>

SearchAttributes

List of (partial & exact) attributes to use for identification.

Declaration

cs-api-definition
public string SearchAttributes { get; }

Property Value

string

TagIndex

Gets/Sets tagName occurrence index when Type=TagIndex

Declaration

cs-api-definition
public int TagIndex { get; set; }

Property Value

int

TagName

Gets/Sets the tagName of the element this parameter identifies.

Declaration

cs-api-definition
public string TagName { get; set; }

Property Value

string

Type

Gets/Sets the identification type to use to identify this element. (Default:TagIndex)

Declaration

cs-api-definition
public FindType Type { get; set; }

Property Value

FindType

XPath

Gets/Sets the XPath to use when Type=XPath.

Declaration

cs-api-definition
public string XPath { get; set; }

Property Value

string

Methods

LoadFromFile(string)

Load a FindParam from a file.

Declaration

cs-api-definition
public static FindParam LoadFromFile(string fileName)

Parameters

fileName

string

The file name to load the xml from.

Returns

FindParam

The FindParam object.

LoadFromXml(string)

Load a FindParam from an xml persisted string.

Declaration

cs-api-definition
public static FindParam LoadFromXml(string findParamXml)

Parameters

findParamXml

string

The string.

Returns

FindParam

The FindParam object.

NewExpr(params string[])

Create a FindParam object from an expression.

Declaration

cs-api-definition
public static FindParam NewExpr(params string[] expression)

Parameters

expression

string[]

The expression to use.

Returns

FindParam

The FindParam as an expression.

Save(string)

Serializes and saves the current FindParam to a file. You can later load that file using FindParam.Load().

Declaration

cs-api-definition
public void Save(string fileName)

Parameters

fileName

string

The file name to save to.

SetAttributes(params string[])

Used to initialize a list of parameter value pairs on a FindParam.

Declaration

cs-api-definition
public FindParam SetAttributes(params string[] nameValuePairs)

Parameters

nameValuePairs

string[]

The name value pairs.

Returns

FindParam

The modified FindParam

SetContent(FindContentType, string)

Sets the content type and returns the updated FindParam.

Declaration

cs-api-definition
public FindParam SetContent(FindContentType contentType, string contentValue)

Parameters

contentType

FindContentType

The content type.

contentValue

string

The content.

Returns

FindParam

The modified FindParam

SetTagName(string)

Sets the tag name and returns the updated FindParam.

Declaration

cs-api-definition
public FindParam SetTagName(string tagName)

Parameters

tagName

string

The set tagName

Returns

FindParam

The modified FindParam

ToString()

String representation of the FindParam.

Declaration

cs-api-definition
public override string ToString()

Returns

string

The string representation.

Overrides object.ToString()

ToXml()

Serialize and return the current FindParam as a string. You can later use that string to create a FindParam using the .Load().

Declaration

cs-api-definition
public string ToXml()

Returns

string

The serialized Xml that represents this object.

Events

PropertyChanged

Occurs when a property changes on this FindParam object.

Declaration

cs-api-definition
public event PropertyChangedEventHandler PropertyChanged

Event Value

PropertyChangedEventHandler

Implements INotifyPropertyChanged.PropertyChanged

Extension Methods