Table of Contents

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

string

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 Uri

A Uri object that represents the URL of the page being validated.

settings TestSettings

A TestSettings object that contains the settings for the test.

context TestContext

A TestContext object that represents the test context.

serviceProvider IServiceProvider

An instance object of a mechanism for retrieving a service object.

cancellationToken CancellationToken

An optional CancellationToken object that can be used to cancel this operation.

Returns

Task

Exceptions

ArgumentNullException

If any of the following parameters: url, settings or context is null.