T proxy = null;
if (WebElementFacade.class.isAssignableFrom(interfaceType)) {
handler = new SmartElementHandler(interfaceType, locator, driver, pageObject.waitForTimeoutInMilliseconds());
proxy = (T) Proxy.newProxyInstance(loader, new Class[]{interfaceType}, handler);
} else {
handler = new LocatingElementHandler(locator);
proxy = (T) Proxy.newProxyInstance(loader,
new Class[]{WebElement.class, WrapsElement.class, Locatable.class}, handler);
}
return proxy;