Exemple #1
0
 /// <summary>
 /// Asserts that the element is enabled.
 /// </summary>
 /// <param name="elementHandle">An <see cref="ElementHandle"/></param>
 /// <param name="because">A phrase explaining why the assertion is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.</param>
 /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
 /// <remarks><![CDATA[Elements: <button>, <command>, <fieldset>, <input>, <keygen>, <optgroup>, <option>, <select>, <textarea>]]></remarks>
 public static async Task ShouldBeEnabledAsync(this ElementHandle elementHandle, string because = null)
 {
     if (await elementHandle.IsDisabledAsync().ConfigureAwait(false))
     {
         Throw.ShouldBeEnabled(elementHandle, because);
     }
 }
 /// <summary>
 /// Asserts that the element is enabled.
 /// </summary>
 /// <param name="handle">An <see cref="ElementHandle"/></param>
 /// <param name="message">Optional failure message</param>
 /// <remarks><![CDATA[Elements: <button>, <command>, <fieldset>, <input>, <keygen>, <optgroup>, <option>, <select>, <textarea>]]></remarks>
 public static async Task ShouldBeEnabledAsync(this ElementHandle handle, string message = null)
 {
     if (await handle.IsDisabledAsync().ConfigureAwait(false))
     {
         Throw.ShouldBeEnabled(handle, message);
     }
 }
 /// <summary>
 /// Indicates whether the element is enabled or not. This is the logical negation of <see cref="IsDisabledAsync"/>.
 /// </summary>
 /// <param name="elementHandle">An <see cref="ElementHandle"/></param>
 /// <returns><c>true</c> if the element is enabled</returns>
 /// <remarks><![CDATA[Elements: <button>, <command>, <fieldset>, <input>, <keygen>, <optgroup>, <option>, <select>, <textarea>]]></remarks>
 public static async Task <bool> IsEnabledAsync(this ElementHandle elementHandle)
 {
     return(!await elementHandle.IsDisabledAsync().ConfigureAwait(false));
 }
 /// <summary>
 /// Indicates whether the element is disabled or not.
 /// </summary>
 /// <param name="handle">An <see cref="ElementHandle"/></param>
 /// <remarks><![CDATA[Elements: <button>, <command>, <fieldset>, <input>, <keygen>, <optgroup>, <option>, <select>, <textarea>]]></remarks>
 /// <returns><c>true</c> if the element is disabled</returns>
 public static bool IsDisabled(this ElementHandle handle)
 {
     return(handle.IsDisabledAsync().Result());
 }