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

com.epam.jdi.uitests.web.selenium.elements.base.JdiStatic Maven / Gradle / Ivy

There is a newer version: 1.1.34
Show newest version
package com.epam.jdi.uitests.web.selenium.elements.base;

import com.epam.jdi.uitests.web.settings.WebSettings;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static com.epam.commons.LinqUtils.first;

/**
 * Created by Roman_Iovlev on 2/21/2017.
 */
public class JdiStatic {
    public static J $(WebElement webElement) {
        return new J(webElement);
    }

    public static J $(String cssSelector) {
        return new J(By.cssSelector(cssSelector));
    }

    public static J $(By locator) {
        return new J(locator);
    }

    public static List $$(Collection elements) {
        List r = new ArrayList<>();
        for(WebElement el : elements)
            r.add($(el));
        return r;
    }

    public static List $$(String cssSelector) {
        return $$(By.cssSelector(cssSelector));
    }

    public static List $$(By locator) {
        return $$(WebSettings.getDriver().findElements(locator));
    }

    public static J find(List jList, String value) {
        return first(jList, e -> e.getText().equals(value));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy