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

com.github.hemanthsridhar.pagefactory.FileBasedElementLocatorFactory Maven / Gradle / Ivy

The newest version!
package com.github.hemanthsridhar.pagefactory;

import com.github.hemanthsridhar.builder.CustomAnnotations;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.support.pagefactory.ElementLocator;
import org.openqa.selenium.support.pagefactory.ElementLocatorFactory;

import java.lang.reflect.Field;

/**
 * @author hemanthsridhar
 */

public class FileBasedElementLocatorFactory implements ElementLocatorFactory {
    private final SearchContext searchContext;
    private final Object page;

    public FileBasedElementLocatorFactory(SearchContext searchContext, Object page) {
        this.searchContext = searchContext;
        this.page = page;
    }

    @Override
    public ElementLocator createLocator(Field field) {
        return new FileBasedElementLocator(searchContext, new CustomAnnotations(field, page));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy