Find Class

Progress Software Corporation - Testing Framework 2018.1 Automation Infrastructure
Class provides quick search routines for finding an element(s) within a document.
Inheritance Hierarchy

SystemObject
  ArtOfTest.WebAii.CoreFind
    ArtOfTest.WebAii.Controls.HtmlControlsHtmlFind

Namespace:  ArtOfTest.WebAii.Core
Assembly:  ArtOfTest.WebAii (in ArtOfTest.WebAii.dll) Version: 2018.1.116.0 (2018.1.116.0)
Syntax

public class Find

The Find type exposes the following members.

Properties

  NameDescription
Public propertyAssociatedBrowser
Gets the browser object that is associated with this find object. If this property is null, then the Find object is associated with a search region.
Public propertyFindReferenceType
Gets the reference type that this Find object is using. (i.e. browser root, testregion ... etc)
Public propertyIgnoreFindAllControlMismatch
Gets/Sets whether to ignore Find.Allxx<TControl>(...) elements that don't match the TControl specified. (i.e. the TControl type validation fails for that element). If false, the Find.Allxx method will throw an exception.
Public propertyLastFindParam
Gets the last FindParam used to search.
Public propertyLastSearchLog
Gets the search log for the last find attempt. This log can help diagnose when find fails to locate an element.
Public propertySearchRegion
Gets the search region for this Find object. When this is set to a specific region, all search is done locale to that region. All indexes are calculated starting at zero from this region's element. If this property is null, then the Find object will perform all searches from the document root element.
Public propertySearchRootElement
Gets/Sets the root element that all searches will be performed under. This element depended on the reference type. [Browser/TestRegion/Element].
Public propertyThrowIfNullOrEmpty
Gets/Sets whether to throw an exception if any of the find methods returns a null element or any of the find all methods return empty list of elements.
Top
Methods

  NameDescription
Public methodAllByAttributes(String)
Returns a list of elements that have attributes that match the NameValuePairs passed it fully or partially.
Public methodAllByAttributesTControl(String)
Returns a list of elements that have attributes that match the NameValuePairs passed it fully or partially.
Public methodCode exampleAllByContent(String)
Returns a list of elements that have TextContent that match the specified content 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.
Examples

To find tags with TextContent of: 'foo bar' Example 1: ByContent("l:foo bar"); Example 2: ByContent("p:foo"); Example 3: ByContent("x:[*foo*]");
Remarks

There is a difference between FindContentType.InnerText and FindContentType.TextContent that is worth noting: Example:
Text1
Text2
InnerText for div1 : Text1Text2 {recursive} TextContent of div1 : Text1 {non-recursive} Default for ByContent is TextContent which is the most common usage.
Public methodCode exampleAllByContent(String, FindContentType)
Returns a list of elements that match the specified content. 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.
Examples

To find tags with TextContent of: 'foo bar' Example 1: ByContent("l:foo bar"); Example 2: ByContent("p:foo"); Example 3: ByContent("x:[*foo*]");
Remarks

There is a difference between FindContentType.InnerText and FindContentType.TextContent that is worth noting: Example:
Text1
Text2
InnerText for div1 : Text1Text2 {recursive} TextContent of div1 : Text1 {non-recursive} Default for ByContent is TextContent which is the most common usage.
Public methodCode exampleAllByContentTControl(String)
Returns a list of elements that have TextContent that match the specified content 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.
Examples

To find tags with TextContent of: 'foo bar' Example 1: ByContent("l:foo bar"); Example 2: ByContent("p:foo"); Example 3: ByContent("x:[*foo*]");
Remarks

There is a difference between FindContentType.InnerText and FindContentType.TextContent that is worth noting: Example:
Text1
Text2
InnerText for div1 : Text1Text2 {recursive} TextContent of div1 : Text1 {non-recursive} Default for ByContent is TextContent which is the most common usage.
Public methodCode exampleAllByContentTControl(String, FindContentType)
Returns a list of elements that match the specified content. 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.
Examples

To find tags with TextContent of: 'foo bar' Example 1: ByContent("l:foo bar"); Example 2: ByContent("p:foo"); Example 3: ByContent("x:[*foo*]");
Remarks

There is a difference between FindContentType.InnerText and FindContentType.TextContent that is worth noting: Example:
Text1
Text2
InnerText for div1 : Text1Text2 {recursive} TextContent of div1 : Text1 {non-recursive} Default for ByContent is TextContent which is the most common usage.
Public methodAllByCustom(PredicateElement)
Return all elements that match the predicate
Public methodAllByCustomTControl(PredicateTControl)
Returns all controls that match the predicate and are convertable to TControl.
Public methodAllByExpression(String)
Find all elements by HTML find expression strings.
Public methodAllByExpression(HtmlFindExpression)
Find all elements by HtmlFindExpression.
Public methodAllByExpressionTControl(String)
Find all elements by HTML find expression strings of type TControl.
Public methodAllByExpressionTControl(HtmlFindExpression)
Find all elements by HtmlFindExpression of type TControl.
Public methodAllByTagName(String)
Returns a list of elements with a specific tag name.
Public methodAllByTagNameTControl(String)
Returns a list of elements with a specific tag name as a control collection.
Public methodAllByXPath(String)
Returns a list of elements that match the specified XPath. This function supports the System.Xml XPath syntax.
Public methodAllByXPathTControl(String)
Returns a list of elements that match the specified XPath. This function supports the System.Xml XPath syntax.
Public methodAllControlsTControl
Gets an IEnmerable for TControl to be used for LINQ queries. This will return only elements that are convertable to TControl
Public methodAllElements
Gets a IEnumerable for all elements to be used for LINQ queries
Public methodStatic memberBuildBestFitFindExpression
Generates a HtmlFindExpression to be used to find the specified element. The function uses an algorithm optimized for most reliable search methods and will revert back to using the tagname index as a last resort
Public methodByAttributes(String)
Returns a an element that has attributes that match the NameValuePairs passed it. All matching is case-insensitive.
Public methodByAttributesTControl(String)
Same as ByAttributes(). Returns a control type instead of element.
Public methodCode exampleByContent(String)
Returns an element by searching its TextContent. 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.
Examples

To find tags with innerText content is: 'foo bar' Example 1: ByContent("l:foo bar"); Example 2: ByContent("p:foo"); Example 3: ByContent("x:[*foo*]");
Public methodCode exampleByContent(String, FindContentType)
Returns an element by searching its content with the options to pick the content type. (InnerText, InnerMarkup or OuterMarkup) 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.
Examples

Similar to Find.ByContent(string) with the option to specify the content type: Example 1: ByContent("l:foo bar",FindContentType.InnerText); Example 2: ByContent("p:<foo id="f" />",FindContent.OuterMarkup);
Remarks

There is a difference between FindContentType.InnerText and FindContentType.TextContent that is worth noting: Example:
Text1
Text2
InnerText for div1 : Text1Text2 {recursive} TextContent of div1 : Text1 {non-recursive} Default for ByContent is TextContent which is the most common usage.
Public methodCode exampleByContent(String, FindContentType, String)
Returns an element by searching its content with the options to pick the content type. (InnerText, InnerMarkup or OuterMarkup) in addition to a list of attributes. 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.
Examples

Similar to Find.ByContent(string) with the option to specify the content type: Example 1: ByContent("l:foo bar",FindContentType.InnerText); Example 2: ByContent("p:<foo id="f" />",FindContent.OuterMarkup);
Remarks

There is a difference between FindContentType.InnerText and FindContentType.TextContent that is worth noting: Example:
Text1
Text2
InnerText for div1 : Text1Text2 {recursive} TextContent of div1 : Text1 {non-recursive} Default for ByContent is TextContent which is the most common usage.
Public methodByContentTControl(String)
Same as ByContent(). Returns a control type instead of element.
Public methodByContentTControl(String, FindContentType)
Same as ByContent(). Returns a control type instead of element.
Public methodByContentTControl(String, FindContentType, String)
Same as ByContent(). Returns a control type instead of element.
Public methodByCustom(PredicateElement)
Return the element that matches the defined predicate.
Public methodByCustomTControl(PredicateTControl)
Get a control by using custom predicate. This function will try to eliminate any elements that are not convertable to TControl type.
Public methodByExpression(String)
Find element by HTML find expression strings.
Public methodByExpression(HtmlFindExpression)
Find element by HtmlFindExpression.
Public methodByExpression(HtmlFindExpression, Boolean)
Public methodByExpressionTControl(String)
Find element by HTML find expression strings of type TControl.
Public methodByExpressionTControl(HtmlFindExpression)
Find element by HtmlFindExpression of type TControl.
Public methodById(String)
Returns an element by looking for its 'id' attribute value.
Public methodByIdTControl(String)
Same as ById(). Returns a control type instead of element.
Public methodByName(String)
Returns an element by searching for its 'name' attribute value
Public methodByNameTControl(String)
Same as ByName(). Returns a control type instead of element.
Public methodCode exampleByNodeIndexPath(String)
Returns an element by searching for it using a node index path.
Examples

For example: 

This call: ByNodeIndexPath("0/2/0/1") describes the <target></target> element in the below hierarchy:

<referenceElement>
 (0)<foo> 
        <bar> 
        </bar>
        <car> 
        </car>
     (2)<bus>
         (0)<driver>
                <cap>
                </cap>
             (1)<target>
                </target>
            </driver>
        </bus>
    </foo>
</referenceElement>
Public methodByNodeIndexPathTControl(String)
Same as ByNodexIndexPath(). Returns a control type instead of element.
Public methodByTagIndex(String, Int32)
Returns an element by its tag name occrrence.
Public methodByTagIndexTControl(String, Int32)
Same as ByTagIndex(). Returns a control type instead of element.
Public methodByXPath(String)
Returns an element using an XPath. This function supports the System.Xml XPath syntax.
Public methodByXPathTControl(String)
Same as ByXPath(). Returns a control type instead of element.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFromCollection
Finds all elements with the HtmlFindExpressions in the collection.
Public methodFromExpressionsFile
Finds all elements with FindExpressions defined in a file.
Public methodFromExpressionsXml
Finds all elements with FindExpressions defined in the serialized xml string.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Events

  NameDescription
Public eventReturnedNullOrEmpty
Invoked when one of the find methods returns null or an empty list of elements.
Top
Extension Methods

  NameDescription
Public Extension MethodjQuery
Creates and returns a new jQuery object for the Find object.
(Defined by jQueryExtension.)
Top
See Also

Reference