All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.screenplay.ui.PageElementBuilder Maven / Gradle / Ivy

There is a newer version: 4.2.8
Show newest version
package net.serenitybdd.screenplay.ui;

import net.serenitybdd.screenplay.targets.SearchableTarget;
import net.serenitybdd.screenplay.targets.Target;

import static net.serenitybdd.screenplay.ui.LocatorStrategies.containingTextAndMatchingCSS;

public class PageElementBuilder {

    private final String xpathOrCssSelector;

    PageElementBuilder(String selector) {
        this.xpathOrCssSelector = selector;
    }

    public SearchableTarget describedAs(String name) {
        return Target.the(name).locatedBy(xpathOrCssSelector);
    }

    public SearchableTarget containingText(String text) {
        return Target.the("the element containing text '" + text + "'").locatedBy(containingTextAndMatchingCSS(xpathOrCssSelector, text));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy