// GetAttribute /// <summary> /// The value of a specified attribute on the element. /// </summary> /// <param name="elementHandle">An <see cref="ElementHandle"/></param> /// <param name="name">The attribute name</param> /// <returns>The attribute value</returns> /// <seealso href="https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute"/> public static string GetAttribute(this ElementHandle elementHandle, string name) { return(elementHandle.GetAttributeAsync(name).Result()); }
/// <summary> /// Src of the element. /// </summary> /// <param name="elementHandle">An <see cref="ElementHandle"/></param> /// <returns>The element's <c>src</c>, or <c>null</c> if the attribute is missing.</returns> /// <remarks><![CDATA[Elements: <audio>, <embed>, <iframe>, <img>, <input>, <script>, <source>, <track>, <video>]]></remarks> public static async Task <string> SrcAsync(this ElementHandle elementHandle) { return(await elementHandle.GetAttributeAsync("src").ConfigureAwait(false)); }
// Value /// <summary> /// Value of the element /// </summary> /// <param name="handle">An <see cref="ElementHandle"/></param> /// <remarks><![CDATA[Elements: <button>, <option>, <input>, <li>, <meter>, <progress>, <param>]]></remarks> /// <returns>The element <c>value</c>, or <c>null</c> if the attribute is missing.</returns> public static async Task <string> ValueAsync(this ElementHandle handle) { return(await handle.GetAttributeAsync("value").ConfigureAwait(false)); }