/// <summary> /// OuterHtml of the element. /// </summary> /// <param name="elementHandle">An <see cref="ElementHandle"/></param> /// <returns>The element's <c>outerHTML</c></returns> /// <seealso href="https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML"/> public static async Task <string> OuterHtmlAsync(this ElementHandle elementHandle) { return(await elementHandle.GetPropertyValueAsync("outerHTML").ConfigureAwait(false)); }
private static string GetPropertyValue(this ElementHandle handle, string propertyName) { return(handle.GetPropertyValueAsync(propertyName).Result()); }
/// <summary> /// InnerText of the element. /// </summary> /// <param name="elementHandle">An <see cref="ElementHandle"/></param> /// <returns>The element's <c>innerText</c></returns> /// <seealso href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText"/> public static async Task <string> InnerTextAsync(this ElementHandle elementHandle) { return(await elementHandle.GetPropertyValueAsync("innerText").ConfigureAwait(false)); }
// TextContent /// <summary> /// TextContent of the element. /// See also https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent /// </summary> /// <param name="handle">An <see cref="ElementHandle"/></param> /// <returns>The element <c>textContent</c></returns> public static async Task <string> TextContentAsync(this ElementHandle handle) { return(await handle.GetPropertyValueAsync("textContent").ConfigureAwait(false)); }