@SuppressWarnings("unchecked")
    public static <T extends Element> T element(Class<T> type, Locator locator) {
        if (!type.isInterface()) {
            throw new IllegalArgumentException("Element type must be an interface, was: " + type);
        }

        InvocationHandler invocationHandler = new ElementHandler(type, locator);

        return (T) Proxy.newProxyInstance(Elements.class.getClassLoader(),
                new Class[] { type, HasElementContext.class, WrapsElement.class},
                invocationHandler);
    }
@ SuppressWarnings ( "unchecked" ) public static < T extends Element > T element ( Class < T > type , Locator locator ) { if ( ! type . isInterface ( ) ) { throw new IllegalArgumentException ( "Element type must be an interface, was: " + type ) ; } InvocationHandler invocationHandler = new ElementHandler ( type , locator ) ; return ( T ) Proxy . newProxyInstance ( Elements . class . getClassLoader ( ) , new Class [ ] { type , HasElementContext . class , WrapsElement . class } , invocationHandler ) ; }
Looks up a automation-library-specific implementation for that element type, assuming an
implementation is registered for that class.