Interface IHtmlLocatorAssertions
- Namespace
- Xping.Sdk.Validations.Content.Html
- Assembly
- Xping.Sdk.dll
Represents an object for validating an HTML response.
public interface IHtmlLocatorAssertions
Methods
ToHaveCount(int)
Validates that the specified number matches the number of elements corresponding to the provided locator. Usage:
html.GetByRole(AriaRole.Listitem).ToHaveCount(expectedCount);
where 'expectedCount' is the number of elements expected to be found.
IHtmlLocatorAssertions ToHaveCount(int expectedCount)
Parameters
expectedCount
intThe expected number of elements to match the locator.
Returns
- IHtmlLocatorAssertions
The current instance of IHtmlLocatorAssertions for method chaining.
ToHaveInnerHtml(string, TextOptions?)
Confirms that the innerHtml of the element identified by the locator matches the specified string. Example:
html.GetByRole(AriaRole.Listitem).ToHaveInnerHtml("<div>");
In this example, "<div>" is the string anticipated to match the innerHtml of the located element.
IHtmlLocatorAssertions ToHaveInnerHtml(string innerHtml, TextOptions? options = null)
Parameters
innerHtml
stringThe string to verify against the innerHtml of the located element.
options
TextOptionsOptional parameters for customizing the locator behavior.
Returns
- IHtmlLocatorAssertions
The current instance of IHtmlLocatorAssertions for method chaining.
ToHaveInnerHtml(Regex, TextOptions?)
Confirms that the innerHtml of the element identified by the locator matches the specified regex. Example:
html.GetByRole(AriaRole.Listitem).ToHaveInnerText("<div>");
In this example, "<div>" is the string anticipated to match the innerHtml of the located element.
IHtmlLocatorAssertions ToHaveInnerHtml(Regex innerHtml, TextOptions? options = null)
Parameters
innerHtml
RegexThe string to verify against the innerHtml of the located element.
options
TextOptionsOptional parameters for customizing the locator behavior.
Returns
- IHtmlLocatorAssertions
The current instance of IHtmlLocatorAssertions for method chaining.
ToHaveInnerText(IEnumerable<string>, TextOptions?)
Confirms that the inner text of each element identified by the locator matches the corresponding string in the specified enumerable. Example:
html.GetByRole(AriaRole.Listitem).ToHaveInnerText(["Item 1", "Item 2", "Item 3"]);
In this example, "Item 1", "Item 2", and "Item 3" are the strings anticipated to match the inner text of
the located elements. The number of items in nodeInnerTexts
should match the number of
nodes the locator points to.
IHtmlLocatorAssertions ToHaveInnerText(IEnumerable<string> nodeInnerTexts, TextOptions? options = null)
Parameters
nodeInnerTexts
IEnumerable<string>Strings to verify against the nodeInnerTexts of the located elements.
options
TextOptionsOptional parameters for customizing the locator behavior.
Returns
- IHtmlLocatorAssertions
The current instance of IHtmlLocatorAssertions for method chaining.
ToHaveInnerText(string, TextOptions?)
Confirms that the innerText of the element identified by the locator matches the specified string. Example:
html.GetByRole(AriaRole.Listitem).ToHaveInnerText("Sample Text");
In this example, "Sample Text" is the string anticipated to match the innerText of the located element.
IHtmlLocatorAssertions ToHaveInnerText(string innerText, TextOptions? options = null)
Parameters
innerText
stringThe string to verify against the innerText of the located element.
options
TextOptionsOptional parameters for customizing the locator behavior.
Returns
- IHtmlLocatorAssertions
The current instance of IHtmlLocatorAssertions for method chaining.
ToHaveInnerText(Regex, TextOptions?)
Confirms that the innerText of the element identified by the locator matches the specified regex. Example:
html.GetByRole(AriaRole.Listitem).ToHaveInnerText("Sample Text");
In this example, "Sample Text" is the string anticipated to match the innerText of the located element.
IHtmlLocatorAssertions ToHaveInnerText(Regex innerText, TextOptions? options = null)
Parameters
innerText
RegexThe string to verify against the innerText of the located element.
options
TextOptionsOptional parameters for customizing the locator behavior.
Returns
- IHtmlLocatorAssertions
The current instance of IHtmlLocatorAssertions for method chaining.