Beispiel #1
0
        /// <summary>
        /// Runs <c>element.querySelector</c> within the element and returns an <see cref="ElementObject" />.
        /// If no elements match the selector, the return value resolve to <c>null</c>.
        /// </summary>
        /// <typeparam name="T">The type of <see cref="ElementObject" /></typeparam>
        /// <param name="elementHandle">A <see cref="ElementHandle" /></param>
        /// <param name="selector">A selector to query element for</param>
        /// <returns>Task which resolves to the <see cref="ElementObject" /></returns>
        /// <seealso cref="ElementHandle.QuerySelectorAsync(string)"/>
        public static async Task <T> QuerySelectorAsync <T>(this ElementHandle elementHandle, string selector) where T : ElementObject
        {
            var result = await elementHandle.GuardFromNull().QuerySelectorAsync(selector).ConfigureAwait(false);

            return(ProxyFactory.ElementObject <T>(elementHandle.GetPage(), result));
        }