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

nl.praegus.fitnesse.slim.util.element.DummyContext Maven / Gradle / Ivy

There is a newer version: 0.0.22
Show newest version
package nl.praegus.fitnesse.slim.util.element;

import org.openqa.selenium.By;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebElement;

import java.util.List;

import static java.util.Collections.emptyList;

/**
 * Normal 'setFoundBy' logic in RemoteWebDriver calls toString() on SearchContext. For AppiumDriver and its subclasses
 * that means 2 remote calls getting all session details.
 * This context can be used instead as 'foundBy-provider' which just returns a String without any remote calls needed.
 */
public class DummyContext implements SearchContext {
    private final String displayName;

    DummyContext(String displayName) {
        this.displayName = displayName;
    }

    @Override
    public  List findElements(By by) {
        return emptyList();
    }

    @Override
    public  T findElement(By by) {
        return null;
    }

    @Override
    public String toString() {
        return displayName;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy