Defines a custom web element condition using a boolean predicate. Use in Selenium/Selenide tests for custom assertions on elements.
// Source: https://github.com/selenide/selenide | License: MIT | Copyright [2011-2025] [Andrei Solntsev & Selenide committers]
// Provided via justclaw.it.com; keep this notice with the code.
package com.codeborne.selenide.conditions;
import com.codeborne.selenide.CheckResult;
import com.codeborne.selenide.Driver;
import com.codeborne.selenide.WebElementCondition;
import org.openqa.selenium.WebElement;
import java.util.function.Predicate;
public class CustomMatch extends WebElementCondition {
protected final Predicate<WebElement> predicate;
public CustomMatch(String description, Predicate<WebElement> predicate) {
super(description);
this.predicate = predicate;
}
@Override
public CheckResult check(Driver driver, WebElement element) {
boolean matched = predicate.te
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key