Selector

Contains Filters

Methods that filter found elements by checking if a property contains a substring - a looser match than the exact Match methods.

Methods that filter found elements by checking if a property contains a substring - a looser match than the exact Match methods.

Contains methods check whether the specified property includes the provided substring anywhere within its value. ContainsText checks visible text content. ContainsValue checks the value attribute. ContainsAttribute checks for attribute presence or partial attribute content. ContainsHRef checks the href attribute. ContainsSrc checks the src attribute. ContainsPlaceholder checks the placeholder attribute. These are useful when the element has a long, dynamic value but you only know a stable part of it.

Examples

GPAL Fluent: High-level fluent C# API

//Contains filters use a simple substring search (case-sensitive). Chain multiple Contains methods to require multiple substrings, or combine Contains with MatchText/MatchValue for mixed exact-and-partial filtering.

// Find any link that points to a PDF var pdfLink = GPAL.Selector .WithCSS("a") .ContainsHRef(".pdf"); // Find any input whose placeholder mentions 'email' var emailField = GPAL.Selector .WithCSS("input") .ContainsPlaceholder("email"); // Find any row containing the word 'Error' var errorRow = GPAL.Selector .WithCSS(".log-row") .ContainsText("Error");