Selector

Exact Match Filters

Match methods narrow the set of elements returned by the primary locator (CSS, XPath, etc.). MatchText requires the element's visible text to equal the provided string exactly. MatchValue requires the element's value attribute to match. MatchAttribute requires a specific attribute to match. MatchHRef requires the href attribute to match. MatchSrc requires the src attribute to match. MatchPlaceholder requires the placeholder attribute to match. All comparisons are case-sensitive by default.

NOTE

Match methods require the full value to equal the filter string exactly. Use the Contains variants (ContainsText, ContainsAttribute, etc.) when you only know part of the value.

Examples

GPAL Fluent: High-level fluent C# API

//Multiple Match methods can be chained on a single selector - all conditions must be satisfied for an element to pass. Match methods are applied after the primary locator finds its initial candidate set.

// Find the exact 'Submit' link (not 'Submit Form' or 'Submit Order')

var exactLink = GPAL.Selector

.WithCSS("a")

.MatchText("Submit");


// Match by attribute value

var specificInput = GPAL.Selector

.WithCSS("input")

.MatchAttribute("data-type=email");


// Match by href (find a specific link)

var docLink = GPAL.Selector

.WithCSS("a")

.MatchHRef("/documentation");

💬 Ask GPAL