#[non_exhaustive]pub struct FilterOptions {
pub has_text: Option<String>,
pub has_not_text: Option<String>,
pub has: Option<Locator>,
pub has_not: Option<Locator>,
pub visible: Option<bool>,
}Expand description
Options for Locator::filter().
Narrows an existing locator according to the specified criteria. All fields are optional; unset fields are ignored.
See: https://playwright.dev/docs/api/class-locator#locator-filter
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.has_text: Option<String>Matches elements containing the specified text (case-insensitive substring by default).
has_not_text: Option<String>Matches elements that do not contain the specified text anywhere inside.
has: Option<Locator>Narrows to elements that contain a descendant matching this locator.
The inner locator is queried relative to the outer locator’s matched element, not the document root.
has_not: Option<Locator>Narrows to elements that do not contain a descendant matching this locator.
visible: Option<bool>Narrows to elements that are visible (true) or hidden (false).
Locator::visible is the shorthand for the true case.
Implementations§
Source§impl FilterOptions
impl FilterOptions
Sourcepub fn has_text(self, has_text: impl Into<String>) -> Self
pub fn has_text(self, has_text: impl Into<String>) -> Self
Keep only elements containing the given text (case-insensitive substring).
Sourcepub fn has_not_text(self, has_not_text: impl Into<String>) -> Self
pub fn has_not_text(self, has_not_text: impl Into<String>) -> Self
Keep only elements NOT containing the given text.
Sourcepub fn has(self, has: Locator) -> Self
pub fn has(self, has: Locator) -> Self
Keep only elements containing a match for the inner locator.