private static object CreateProxyObject(Type memberType, IElementLocator locator, IEnumerable <By> bys, bool cache)
        {
            object proxyObject = null;

            if (memberType == typeof(IList <IWebElement>))
            {
                foreach (var type in InterfacesToBeProxied)
                {
                    Type listType = typeof(IList <>).MakeGenericType(type);
                    if (listType.Equals(memberType))
                    {
                        proxyObject = WebElementListProxy.CreateProxy(memberType, locator, bys, cache);
                        break;
                    }
                }
            }
            else if (memberType == typeof(IWebElement))
            {
                proxyObject = WebElementProxy.CreateProxy(InterfaceProxyType, locator, bys, cache);
            }
            else
            {
                throw new ArgumentException("Type of member '" + memberType.Name + "' is not IWebElement or IList<IWebElement>");
            }

            return(proxyObject);
        }
        private static object CreateProxyObject(Type memberType, IElementLocator locator, IEnumerable <By> bys, bool cache)
        {
            object proxyObject = null;

            if (memberType == typeof(IList <IWebElement>))
            {
                proxyObject = WebElementListProxy.CreateProxy(locator, bys, cache);
            }
            else if (memberType == typeof(IWebElement))
            {
                proxyObject = WebElementProxy.CreateProxy(locator, bys, cache);
            }
            else
            {
                throw new ArgumentException("Type of member '" + memberType.Name +
                                            "' is not IWebElement or IList<IWebElement>");
            }

            return(proxyObject);
        }