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

org.fluentlenium.core.search.SearchControl Maven / Gradle / Ivy

package org.fluentlenium.core.search;

import io.appium.java_client.AppiumBy;
import io.appium.java_client.MobileBy;
import org.fluentlenium.core.domain.FluentList;
import org.fluentlenium.core.domain.FluentWebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import java.util.List;

/**
 * Control interface to search for elements.
 *
 * @param  fluent web element type
 */
public interface SearchControl {
    //CHECKSTYLE.OFF: MethodName

    /**
     * Wrap raw selenium elements into a list of elements.
     *
     * @param rawElements raw selenium elements
     * @return list of element
     */
    FluentList find(List rawElements);

    /**
     * Wrap raw selenium elements into a list of elements.
     *
     * @param rawElements raw selenium elements
     * @return list of element
     */
    default FluentList $(List rawElements) {
        return find(rawElements);
    }

    /**
     * Find list of elements with CSS selector and filters.
     *
     * @param selector CSS selector
     * @param filters  set of filters
     * @return list of element
     */
    FluentList find(String selector, SearchFilter... filters);

    /**
     * Find list of elements with CSS selector and filters.
     *
     * @param selector CSS selector
     * @param filters  set of filters
     * @return list of element
     */
    default FluentList $(String selector, SearchFilter... filters) {
        return find(selector, filters);
    }

    /**
     * Wrap existing raw selenium element into an element.
     *
     * @param rawElement raw selenium element
     * @return element
     */
    E el(WebElement rawElement);

    /**
     * Find first element with CSS selector and filters.
     *
     * @param selector CSS selector
     * @param filters  set of filters
     * @return element
     */
    default E el(String selector, SearchFilter... filters) {
        return find(selector, filters).first();
    }

    /**
     * Find list of elements with filters.
     *
     * @param filters set of filters in the current context
     * @return list of elements
     */
    FluentList find(SearchFilter... filters);

    /**
     * Find list of elements with filters.
     *
     * @param filters set of filters in the current context
     * @return list of elements
     */
    default FluentList $(SearchFilter... filters) {
        return find(filters);
    }

    /**
     * Find first element with filters.
     *
     * @param filters set of filters in the current context
     * @return element
     */
    default E el(SearchFilter... filters) {
        return find(filters).first();
    }

    /**
     * Find list of elements with Selenium locator and filters.
     *
     * @param locator elements locator
     * @param filters filters set
     * @return list of elements
     */
    FluentList find(By locator, SearchFilter... filters);

    /**
     * Find list of elements with Selenium locator and filters.
     *
     * @param locator elements locator
     * @param filters filters set
     * @return list of elements
     */
    default FluentList $(By locator, SearchFilter... filters) {
        return find(locator, filters);
    }

    /**
     * Find list of elements with Appium locator and filters.
     *
     * @param locator mobile elements locator
     * @param filters filters set
     * @return list of elements
     */
    default FluentList $(AppiumBy locator, SearchFilter... filters) {
        return find(locator, filters);
    }

    /**
     * Find first element with Appium locator and filters.
     *
     * @param locator mobile elements locator
     * @param filters filters set
     * @return element
     */
    default E el(AppiumBy locator, SearchFilter... filters) {
        return find(locator, filters).first();
    }

    /**
     * Find first element with Selenium locator and filters.
     *
     * @param locator elements locator
     * @param filters filters set
     * @return element
     */
    default E el(By locator, SearchFilter... filters) {
        return find(locator, filters).first();
    }
    //CHECKSTYLE.ON: MethodName
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy