示例#1
0
 /// <summary>
 /// Asserts that the element does not have the specified content.
 /// </summary>
 /// <param name="elementHandle">An <see cref="ElementHandle"/></param>
 /// <param name="regex">A regular expression to test against <c>element.textContent</c></param>
 /// <param name="flags">A set of flags for the regular expression</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>
 /// <seealso href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp"/>
 public static async Task ShouldNotHaveContentAsync(this ElementHandle elementHandle, string regex, string flags = "", string because = null)
 {
     if (await elementHandle.HasContentAsync(regex, flags).ConfigureAwait(false))
     {
         Throw.ShouldNotHaveContent(elementHandle, regex, flags, because);
     }
 }
 /// <summary>
 /// Asserts that the element does not have the specified content.
 /// </summary>
 /// <param name="handle">An <see cref="ElementHandle"/></param>
 /// <param name="content">The content</param>
 /// <param name="message">Optional failure message</param>
 /// <remarks>Evaluates <c>node.textContent</c></remarks>
 public static async Task ShouldNotHaveContentAsync(this ElementHandle handle, string content, string message = null)
 {
     if (await handle.HasContentAsync(content).ConfigureAwait(false))
     {
         Throw.ShouldNotHaveContent(handle, message);
     }
 }
 /// <summary>
 /// Indicates whether the element has the specified content or not.
 /// </summary>
 /// <param name="handle">An <see cref="ElementHandle"/></param>
 /// <param name="content">The content</param>
 /// <remarks>Evaluates <c>node.textContent</c></remarks>
 /// <returns><c>true</c> if the element has the specified content</returns>
 public static bool HasContent(this ElementHandle handle, string content)
 {
     return(handle.HasContentAsync(content).Result());
 }
示例#4
0
        // HasContent

        /// <summary>
        /// Indicates whether the element has the specified content or not.
        /// </summary>
        /// <param name="elementHandle">An <see cref="ElementHandle"/></param>
        /// <param name="regex">A regular expression to test against <c>element.textContent</c></param>
        /// <param name="flags">A set of flags for the regular expression</param>
        /// <returns><c>true</c> if the element has the specified content</returns>
        /// <seealso href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp"/>
        public static bool HasContent(this ElementHandle elementHandle, string regex, string flags = "")
        {
            return(elementHandle.HasContentAsync(regex, flags).Result());
        }