Class ElementBy


  • public final class ElementBy
    extends Object

    A set of static methods to extend the search mechanism.
    It is used to simplify commonly used FindBy. For example:

    WebElement myElement = driver.findElement(ElementBy.partialText("searchText"));

    Since:
    0.1
    Author:
    Nir Gallner
    See Also:
    ByAll, AllBy, AnyBy, InputBy, NotBy, TdBy
    • Method Detail

      • partialText

        public static org.openqa.selenium.By partialText​(String text)
        Finds an element by using any part of it's tag value. For example - <tagName>value</tagName> can be discovered by "value" or "val" using the following code:
        List<WebElement> myList = driver.findElements(ElementBy.partialText("val"));

        Parameters:
        text - the string to be searched
        Returns:
        a By object with the string to be searched, ready to be sent to findElement or findElements