Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package uk.sponte.automation.seleniumpom.proxies.handlers;
 
 import  org.openqa.selenium.By;
 import  org.openqa.selenium.SearchContext;
 import  org.openqa.selenium.WebDriver;
 import  org.openqa.selenium.WebElement;
Invocation handler for page section lists Created by n450777 on 08/04/15.
public class PageSectionListHandler implements InvocationHandler {
    private WebDriver driver;
    private SearchContext searchContext;
    private By by;
    private Type pageSectionType;
    private PageFactory pageFactory;
    public PageSectionListHandler(
            WebDriver driver,
            SearchContext searchContext,
            By by,
            Type pageSectionType,
            PageFactory pageFactory) {
        this. = driver;
        this. = searchContext;
        this. = by;
        this. = pageSectionType;
        this. = pageFactory;
    }
    @Override
    public Object invoke(Object proxyMethod methodObject[] argsthrows Throwable {
        List<WebElement> elements = .findElements();
        List<ObjectpageSections = new ArrayList<Object>();
        for (WebElement element : elements) {
            PageElementImpl webElementExtensions = new PageElementImpl(element);
            InvocationHandler pageElementHandler = new ElementHandler(elementwebElementExtensions);
            PageElement instance = (PageElement)Proxy.newProxyInstance(
                    PageElement.class.getClassLoader(),
                    new Class[]{PageElement.class},
                    pageElementHandler);
            Class<?> pageSectionClass = (Class<?>) this.;
            Object pageSection = .get(pageSectionClassinstance);
            pageSections.add(pageSection);
        }
        return method.invoke(pageSectionsargs);
    }
New to GrepCode? Check out our FAQ X