Beispiel #1
0
        /// <summary>
        ///     Creates the typified element instance.
        /// </summary>
        /// <param name="elementType">Type of the element.</param>
        /// <param name="elementToWrap">The element to wrap.</param>
        /// <returns>The value.</returns>
        public static TypifiedElement CreateTypifiedElementInstance(Type elementType, IWebElement elementToWrap)
        {
            if (typeof(TypifiedElement).IsAssignableFrom(elementType))
            {
                return(HtmlElementUtils.NewInstance <TypifiedElement>(elementType, elementToWrap));
            }

            throw new HtmlElementsException(string.Format(CultureInfo.InvariantCulture,
                                                          "Type '{0}' isn't a derivative type of 'TypifiedElement'", elementType));
        }
Beispiel #2
0
        /// <summary>
        ///     Creates the HTML element instance.
        /// </summary>
        /// <param name="elementType">Type of the element.</param>
        /// <returns>The value.</returns>
        public static HtmlElement CreateHtmlElementInstance(Type elementType)
        {
            if (typeof(HtmlElement).IsAssignableFrom(elementType))
            {
                return(HtmlElementUtils.NewInstance <HtmlElement>(elementType));
            }

            throw new HtmlElementsException(string.Format(CultureInfo.InvariantCulture,
                                                          "Type '{0}' is not a derivative type of 'HtmlElement'", elementType));
        }
Beispiel #3
0
 /// <summary>
 ///     Creates the page object instance.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="driver">The driver.</param>
 /// <returns>The value.</returns>
 public static object CreatePageObjectInstance(Type type, IWebDriver driver)
 {
     return(HtmlElementUtils.NewInstance <object>(type, driver));
 }