The MemoryHtmlPage class provides a HtmlPage created from a string of HTML rather than the result of a browser request.
Inheritance: HtmlPage
Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DynamicHtmlPage"/> class.
        /// </summary>
        /// <param name="browser">
        /// The browser.
        /// </param>
        /// <param name="html">
        /// The HTML.
        /// </param>
        /// <remarks>
        /// This constructor supports the usage of a dynamic HTML page generated from in-memory HTML rather than resulting
        ///     from a browser request.
        /// </remarks>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="browser"/> parameter is <c>null</c>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The <paramref name="html"/> parameter is <c>null</c>, empty or only contains white
        ///     space.
        /// </exception>
        public DynamicHtmlPage(IBrowser browser, string html)
        {
            if (browser == null)
            {
                throw new ArgumentNullException("browser");
            }

            if (string.IsNullOrWhiteSpace(html))
            {
                throw new ArgumentException(Resources.HtmlPage_NoHtmlContentProvided, "html");
            }

            // Create a wrapper page using the MemoryHtmlPage
            var wrapperPage = new MemoryHtmlPage(browser, html);

            Initialize(wrapperPage);
        }