Class PageContentValidator
- Namespace
- Xping.Sdk.Validations.Content.Page
- Assembly
- Xping.Sdk.dll
Represents a validator that checks if a http content response rendered in the browser matches a specified pattern or condition.
public class PageContentValidator : BaseContentValidator, ITestComponent
- Inheritance
-
PageContentValidator
- Implements
- Inherited Members
Remarks
note
The PageContentValidator component requires the Browser component to be registered before it in the pipeline, because it depends on the HTTP response results from this component.
Constructors
PageContentValidator(Func<IPage, Task>)
Initializes a new instance of the PageContentValidator class.
public PageContentValidator(Func<IPage, Task> validation)
Parameters
validation
Func<IPage, Task>A function that determines whether the html content matches a specififed condition.
Exceptions
- ArgumentNullException
Thrown when the validation function is null.
Fields
StepName
The name of the test component that represents a StringContentValidator test operation.
public const string StepName = "PageContentValidator"
Field Value
Remarks
This constant is used to register the StringContentValidator class in the test framework.
Methods
HandleAsync(Uri, TestSettings, TestContext, IServiceProvider, CancellationToken)
This method performs the test step operation asynchronously.
public override Task HandleAsync(Uri url, TestSettings settings, TestContext context, IServiceProvider serviceProvider, CancellationToken cancellationToken = default)
Parameters
url
UriA Uri object that represents the URL of the page being validated.
settings
TestSettingsA TestSettings object that contains the settings for the test.
context
TestContextA TestContext object that represents the test context.
serviceProvider
IServiceProviderAn instance object of a mechanism for retrieving a service object.
cancellationToken
CancellationTokenAn optional CancellationToken object that can be used to cancel this operation.
Returns
Exceptions
- ArgumentNullException
If any of the following parameters: url, settings or context is null.