Table of Contents

Class QueryPredicatePrototypeBuilder

Namespace
CSF.Screenplay.Selenium.Builders
Assembly
CSF.Screenplay.Selenium.dll

Provides methods to build WebDriver predicate functions for a target element.

public class QueryPredicatePrototypeBuilder
Inheritance
QueryPredicatePrototypeBuilder
Inherited Members

Examples

This first example shows how a Wait action may be written, to wait until the text of a status display reads "finished". Note the section .Has.Text("finished"), which demonstrates use of the functionality of this class.

using CSF.Screenplay.Selenium.Elements;
using static CSF.Screenplay.Selenium.PerformableBuilder;

readonly ITarget status = new CssSelector("#footer .status", "the status display");

// Within the logic of a custom task, deriving from IPerformable
public async ValueTask PerformAsAsync(ICanPerform actor, CancellationToken cancellationToken = default)
{
    // ... other performance logic
    await actor.PerformAsync(WaitUntil(status.Has().Text("finished"), cancellationToken);
    // ... other performance logic
}

The second example, below, shows the usage of FilterElements, matching only elements which are larger than 50×50 pixels in both dimensions. Imagine a bubble chart, in which we are looking for bubbles larger than a certain size. Note the section .ForThoseWhich(q => q.Size(s => s.Height > 50 && s.Width > 50)), which demonstrates use of the functionality of this class.

using CSF.Screenplay.Selenium.Elements;
using static CSF.Screenplay.Selenium.PerformableBuilder;

readonly ITarget bubbles = new CssSelector(".bubble_chart .bubble", "the items in the bubble chart");

// Within the logic of a custom task, deriving from IPerformableWithResult<SeleniumElementCollection>
public async ValueTask<SeleniumElementCollection> PerformAsAsync(ICanPerform actor, CancellationToken cancellationToken = default)
{
    // ... other performance logic
    var allBubbles = await actor.PerformAsync(FindElementsOnThePage().WhichMatch(bubbles), cancellationToken);
    var largeBubbles = await actor.PerformAsync(Filter(allBubbles)
                                                .ForThoseWhich(q => q.Size(s => s.Height > 50 && s.Width > 50)),
                                               cancellationToken);
    // ... other performance logic
}

Remarks

Predicates, built by the members of this class, are primarily used for two purposes:

  • The Wait action, to specify the condition under which the wait should end.
  • The FilterElements question, to specify the criteria by which to match elements.

For more information about interrogating the state of targets, see Queries; queries are the foundation upon which this predicate functionality is based.

Constructors

QueryPredicatePrototypeBuilder(ITarget, bool)

Initializes a new instance of the QueryPredicatePrototypeBuilder class for creating instances of QueryPredicatePrototype<TQueryable> which are suitable for use as either WaitUntilPredicate<T> or CSF.Specifications.ISpecificationFunction<T>.

public QueryPredicatePrototypeBuilder(ITarget target, bool multiElement)

Parameters

target ITarget

The target element for the queries.

multiElement bool

If set to true then this builder will get a predicate which works for targets which represent a collection of HTML elements; otherwise it will get a predicate for a single HTML element.

Methods

AllClasses(params string[])

Creates a query predicate for the presence of all the specified HTML classes (amongst the class attribute's values).

public QueryPredicatePrototype<string> AllClasses(params string[] classes)

Parameters

classes string[]

The names of the classes to query.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

The underlying implementation of this method makes use of the GetAttribute method of Selenium's IWebElement type to query the current attribute value. The get-attribute behaviour queries the corresponding DOM property of the element first, before querying the HTML attribute. Thus, if the DOM has been updated since the element was rendered onto the page, the current live value of the element will be used. Selenium's get-attribute functionality also has special handling for certain attributes such as class & readonly. When inspecting the DOM properties, these names are transparently normalised to className and readOnly respectively. Finally, 'boolean' attribute values are returned with either the string true if present or null if not.

This method inspects the class attribute and determines whether every one of the specified classes are present in the element's class list.

Attribute(string)

Creates a query predicate for the presence of a specified HTML attribute.

public QueryPredicatePrototype<string> Attribute(string attributeName)

Parameters

attributeName string

The name of the attribute to query.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

The underlying implementation of this method makes use of the GetAttribute method of Selenium's IWebElement type to query the current attribute value. The get-attribute behaviour queries the corresponding DOM property of the element first, before querying the HTML attribute. Thus, if the DOM has been updated since the element was rendered onto the page, the current live value of the element will be used. Selenium's get-attribute functionality also has special handling for certain attributes such as class & readonly. When inspecting the DOM properties, these names are transparently normalised to className and readOnly respectively. Finally, 'boolean' attribute values are returned with either the string true if present or null if not.

This method specifically targets that last behaviour, described above. It verifies that the response for attribute's value is not null.

AttributeValue(string, Func<string, bool>)

Creates a query predicate based on a specified HTML attribute and a predicate for the attribute's value.

public QueryPredicatePrototype<string> AttributeValue(string attributeName, Func<string, bool> predicate)

Parameters

attributeName string

The name of the attribute to query.

predicate Func<string, bool>

The predicate to apply to the attribute value.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

The underlying implementation of this method makes use of the GetAttribute method of Selenium's IWebElement type to query the current attribute value. The get-attribute behaviour queries the corresponding DOM property of the element first, before querying the HTML attribute. Thus, if the DOM has been updated since the element was rendered onto the page, the current live value of the element will be used. Selenium's get-attribute functionality also has special handling for certain attributes such as class & readonly. When inspecting the DOM properties, these names are transparently normalised to className and readOnly respectively. Finally, 'boolean' attribute values are returned with either the string true if present or null if not.

Note that the last behaviour, described above, means that this method may be used to match elements which do not have the specified attribute, by using a predicate which checks for null.

AttributeValue(string, string)

Creates a query predicate for the presence of a specified HTML attribute, with a specified value.

public QueryPredicatePrototype<string> AttributeValue(string attributeName, string value)

Parameters

attributeName string

The name of the attribute to query.

value string

The value of the attribute to query.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

The underlying implementation of this method makes use of the GetAttribute method of Selenium's IWebElement type to query the current attribute value. The get-attribute behaviour queries the corresponding DOM property of the element first, before querying the HTML attribute. Thus, if the DOM has been updated since the element was rendered onto the page, the current live value of the element will be used. Selenium's get-attribute functionality also has special handling for certain attributes such as class & readonly. When inspecting the DOM properties, these names are transparently normalised to className and readOnly respectively. Finally, 'boolean' attribute values are returned with either the string true if present or null if not.

Note that the last behaviour, described above, means that this method may be used to match elements which do not have the specified attribute, by using null as the desired value.

Class(string)

Creates a query predicate for the presence of a specified HTML class (amongst the class attribute's values).

public QueryPredicatePrototype<string> Class(string @class)

Parameters

class string

The name of the class to query.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

The underlying implementation of this method makes use of the GetAttribute method of Selenium's IWebElement type to query the current attribute value. The get-attribute behaviour queries the corresponding DOM property of the element first, before querying the HTML attribute. Thus, if the DOM has been updated since the element was rendered onto the page, the current live value of the element will be used. Selenium's get-attribute functionality also has special handling for certain attributes such as class & readonly. When inspecting the DOM properties, these names are transparently normalised to className and readOnly respectively. Finally, 'boolean' attribute values are returned with either the string true if present or null if not.

This method inspects the class attribute and determines whether the specified class is present amongst the element's class list.

Clickability(bool)

Creates a query predicate based on whether the element is clickable.

public QueryPredicatePrototype<bool> Clickability(bool value)

Parameters

value bool

The value to compare against the element's "clickability".

Returns

QueryPredicatePrototype<bool>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

An element is considered 'clickable' if it is both visible in the web browser and it is not disabled.

Clickability(Func<bool, bool>)

Creates a query predicate based on the element's clickability.

public QueryPredicatePrototype<bool> Clickability(Func<bool, bool> predicate)

Parameters

predicate Func<bool, bool>

The predicate to apply to the element's "clickability".

Returns

QueryPredicatePrototype<bool>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

An element is considered 'clickable' if it is both visible in the web browser and it is not disabled.

Clickable()

Creates a query predicate for only clickable elements.

public QueryPredicatePrototype<bool> Clickable()

Returns

QueryPredicatePrototype<bool>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

An element is considered 'clickable' if it is both visible in the web browser and it is not disabled.

CssProperty(string, Func<string, bool>)

Creates a query predicate based on a specified CSS property and a predicate for the property's value.

public QueryPredicatePrototype<string> CssProperty(string propertyName, Func<string, bool> predicate)

Parameters

propertyName string

The name of the property to query.

predicate Func<string, bool>

The predicate to apply to the property value.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

Note that this is not limited to reading the styling of an element/elements as it was defined in a stylesheet. It reads the live styling of the element as it is when the question executes. Thus, if JavaScript or a class change has altered the styling of the element since it was first rendered on-screen, its up-to-date styling information will be inspected.

CssProperty(string, string)

Creates a query predicate based on a specified CSS property and a desired value for that property.

public QueryPredicatePrototype<string> CssProperty(string propertyName, string value)

Parameters

propertyName string

The name of the property to query.

value string

The value to compare against the property value.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

Note that this is not limited to reading the styling of an element/elements as it was defined in a stylesheet. It reads the live styling of the element as it is when the question executes. Thus, if JavaScript or a class change has altered the styling of the element since it was first rendered on-screen, its up-to-date styling information will be inspected.

Location(Point)

Creates a query predicate based on the element's location (its top-left corner).

public QueryPredicatePrototype<Point> Location(Point value)

Parameters

value Point

The value to compare against the element's location.

Returns

QueryPredicatePrototype<Point>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Location(Func<Point, bool>)

Creates a query predicate based on the element's location (its top-left corner).

public QueryPredicatePrototype<Point> Location(Func<Point, bool> predicate)

Parameters

predicate Func<Point, bool>

The predicate to apply to the element's location.

Returns

QueryPredicatePrototype<Point>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

NotClass(string)

Creates a query predicate for the absence of a specified HTML class (amongst the class attribute's values).

public QueryPredicatePrototype<string> NotClass(string @class)

Parameters

class string

The name of the class to query.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

The underlying implementation of this method makes use of the GetAttribute method of Selenium's IWebElement type to query the current attribute value. The get-attribute behaviour queries the corresponding DOM property of the element first, before querying the HTML attribute. Thus, if the DOM has been updated since the element was rendered onto the page, the current live value of the element will be used. Selenium's get-attribute functionality also has special handling for certain attributes such as class & readonly. When inspecting the DOM properties, these names are transparently normalised to className and readOnly respectively. Finally, 'boolean' attribute values are returned with either the string true if present or null if not.

This method inspects the class attribute and determines whether the specified class is not present amongst the element's class list.

NotClickable()

Creates a query predicate for only elements which are not clickable.

public QueryPredicatePrototype<bool> NotClickable()

Returns

QueryPredicatePrototype<bool>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

An element is considered 'clickable' if it is both visible in the web browser and it is not disabled.

NotVisible()

Creates a query predicate for elements that are not visible.

public QueryPredicatePrototype<bool> NotVisible()

Returns

QueryPredicatePrototype<bool>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Options(Func<IReadOnlyList<Option>, bool>)

Creates a query predicate based on the <option> elements, which are children of the current element, regardless of their selected state.

public QueryPredicatePrototype<IReadOnlyList<Option>> Options(Func<IReadOnlyList<Option>, bool> predicate)

Parameters

predicate Func<IReadOnlyList<Option>, bool>

The predicate to apply to the element's options.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

OptionsWithText(params string[])

Creates a query predicate based on the <option> elements, which are children of the current element, regardless of their selected state.

public QueryPredicatePrototype<IReadOnlyList<Option>> OptionsWithText(params string[] optionTexts)

Parameters

optionTexts string[]

The display text of the options to match against.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

This specification will match the element if its options are precisely those specified by optionTexts. The order of the options does not matter, but they must match exactly. This method identifies the options by their display text.

OptionsWithValue(params string[])

Creates a query predicate based on the <option> elements, which are children of the current element, regardless of their selected state.

public QueryPredicatePrototype<IReadOnlyList<Option>> OptionsWithValue(params string[] optionValues)

Parameters

optionValues string[]

The DOM values of the options to match against.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

This specification will match the element if its options are precisely those specified by optionValues. The order of the options does not matter, but they must match exactly. This method identifies the options by their DOM value.

SelectedOptions(Func<IReadOnlyList<Option>, bool>)

Creates a query predicate based on the <option> elements, which are children of the current element, which are selected.

public QueryPredicatePrototype<IReadOnlyList<Option>> SelectedOptions(Func<IReadOnlyList<Option>, bool> predicate)

Parameters

predicate Func<IReadOnlyList<Option>, bool>

The predicate to apply to the element's selected options.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

SelectedOptionsWithText(params string[])

Creates a query predicate based on the <option> elements, which are children of the current element, which are selected.

public QueryPredicatePrototype<IReadOnlyList<Option>> SelectedOptionsWithText(params string[] optionTexts)

Parameters

optionTexts string[]

The display text of the options to match against.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

This specification will match the element if its selected options are precisely those specified by optionTexts. The order of the options does not matter, but they must match exactly. This method identifies the options by their display text.

SelectedOptionsWithValue(params string[])

Creates a query predicate based on the <option> elements, which are children of the current element, which are selected.

public QueryPredicatePrototype<IReadOnlyList<Option>> SelectedOptionsWithValue(params string[] optionValues)

Parameters

optionValues string[]

The DOM values of the options to match against.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

This specification will match the element if its selected options are precisely those specified by optionValues. The order of the options does not matter, but they must match exactly. This method identifies the options by their DOM value.

Size(Size)

Creates a query predicate based on the element's size (width & height in pixels).

public QueryPredicatePrototype<Size> Size(Size value)

Parameters

value Size

The value to compare against the element's size.

Returns

QueryPredicatePrototype<Size>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Size(Func<Size, bool>)

Creates a query predicate based on the element's size (width & height in pixels).

public QueryPredicatePrototype<Size> Size(Func<Size, bool> predicate)

Parameters

predicate Func<Size, bool>

The predicate to apply to the element's size.

Returns

QueryPredicatePrototype<Size>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Text(Func<string, bool>)

Creates a query predicate based on the element's text content.

public QueryPredicatePrototype<string> Text(Func<string, bool> predicate)

Parameters

predicate Func<string, bool>

The predicate to apply to the element's text.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

When reading text from the web browser, this predicate will trim leading/trailing whitespace from that text before comparing it. This is because some browsers (Safari) include whitespace at the beginning/end of text read from the browser, which isn't visible to the end user. This is typically the space which is inherent in the markup, but which browsers ignore when actually displaying content.

By trimming whitespace, the Selenium extension for Screenplay ensures that behaviour is consistent cross-browser. If this causes an issue and you would like the leading/trailing whitespace included the use TextWithoutTrimmingWhitespace(string) instead.

Text(string)

Creates a query predicate based on the element's text content.

public QueryPredicatePrototype<string> Text(string value)

Parameters

value string

The value to compare against the element's text.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

When reading text from the web browser, this predicate will trim leading/trailing whitespace from that text before comparing it. This is because some browsers (Safari) include whitespace at the beginning/end of text read from the browser, which isn't visible to the end user. This is typically the space which is inherent in the markup, but which browsers ignore when actually displaying content.

By trimming whitespace, the Selenium extension for Screenplay ensures that behaviour is consistent cross-browser. If this causes an issue and you would like the leading/trailing whitespace included the use TextWithoutTrimmingWhitespace(string) instead.

TextWithoutTrimmingWhitespace(Func<string, bool>)

Creates a query predicate based on the element's text content.

public QueryPredicatePrototype<string> TextWithoutTrimmingWhitespace(Func<string, bool> predicate)

Parameters

predicate Func<string, bool>

The predicate to apply to the element's text.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

When reading text from the web browser, this predicate will preserve any leading/trailing whitespace in the text without trimming it. Be aware that some browsers (Safari) may include leading/trailing whitespace when reading text, which other WebDriver implementations do not. This can result in inconsistent results when operating cross-browser. If cross-browser consistency is important then consider using Text(Func<string, bool>) instead.

TextWithoutTrimmingWhitespace(string)

Creates a query predicate based on the element's text content, without trimming leading/trailing whitespace.

public QueryPredicatePrototype<string> TextWithoutTrimmingWhitespace(string value)

Parameters

value string

The value to compare against the element's text.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

When reading text from the web browser, this predicate will preserve any leading/trailing whitespace in the text without trimming it. Be aware that some browsers (Safari) may include leading/trailing whitespace when reading text, which other WebDriver implementations do not. This can result in inconsistent results when operating cross-browser. If cross-browser consistency is important then consider using Text(string) instead.

UnselectedOptions(Func<IReadOnlyList<Option>, bool>)

Creates a query predicate based on the <option> elements, which are children of the current element, which are not selected.

public QueryPredicatePrototype<IReadOnlyList<Option>> UnselectedOptions(Func<IReadOnlyList<Option>, bool> predicate)

Parameters

predicate Func<IReadOnlyList<Option>, bool>

The predicate to apply to the element's unselected options.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

UnselectedOptionsWithText(params string[])

Creates a query predicate based on the <option> elements, which are children of the current element, which are not selected.

public QueryPredicatePrototype<IReadOnlyList<Option>> UnselectedOptionsWithText(params string[] optionTexts)

Parameters

optionTexts string[]

The display text of the options to match against.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

This specification will match the element if its unselected options are precisely those specified by optionTexts. The order of the options does not matter, but they must match exactly. This method identifies the options by their display text.

UnselectedOptionsWithValue(params string[])

Creates a query predicate based on the <option> elements, which are children of the current element, which are not selected.

public QueryPredicatePrototype<IReadOnlyList<Option>> UnselectedOptionsWithValue(params string[] optionValues)

Parameters

optionValues string[]

The DOM values of the options to match against.

Returns

QueryPredicatePrototype<IReadOnlyList<Option>>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Remarks

This specification will match the element if its unselected options are precisely those specified by optionValues. The order of the options does not matter, but they must match exactly. This method identifies the options by their DOM value.

Value(Func<string, bool>)

Creates a query predicate based on the element's DOM value.

public QueryPredicatePrototype<string> Value(Func<string, bool> predicate)

Parameters

predicate Func<string, bool>

The predicate to apply to the element's DOM value.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Value(string)

Creates a query predicate based on the element's DOM value.

public QueryPredicatePrototype<string> Value(string value)

Parameters

value string

The value to compare against the element's DOM value.

Returns

QueryPredicatePrototype<string>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Visibility(bool)

Creates a query predicate based on whether the element is visible.

public QueryPredicatePrototype<bool> Visibility(bool value)

Parameters

value bool

The value to compare against the element's visibility.

Returns

QueryPredicatePrototype<bool>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Visibility(Func<bool, bool>)

Creates a query predicate based on whether the element is visible.

public QueryPredicatePrototype<bool> Visibility(Func<bool, bool> predicate)

Parameters

predicate Func<bool, bool>

The predicate to apply to the element's visibility.

Returns

QueryPredicatePrototype<bool>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

Visible()

Creates a query predicate for elements that are visible.

public QueryPredicatePrototype<bool> Visible()

Returns

QueryPredicatePrototype<bool>

A QueryPredicatePrototype<TQueryable>, which may be converted to a full predicate.

Examples

See the remarks for the class QueryPredicatePrototypeBuilder for two examples of usage. The methods of this type all follow the same broad pattern to create predicates.

See Also