Class BrowserRequestSender
The BrowserRequestSender class is a subclass of the TestComponent abstract class that implements the ITestComponent interface. It is used to send HTTP requests to a web application using a headless browserClient, such as Chromium, Firefox, or WebKit. It uses the Playwright library to create and control the headless browserClient instance.
public sealed class BrowserRequestSender : TestComponent, ITestComponent
- Inheritance
-
BrowserRequestSender
- Implements
- Inherited Members
Remarks
Before using this test component, you need to register the necessary services by calling the AddBrowserClientFactory(IServiceCollection) method which adds IBrowserFactory factory service. The Xping SDK provides a default implementation of this interface, called DefaultBrowserFactory, which based on the BrowserConfiguration creates a Chromium, WebKit or Firefox headless browserClient instance. You can also implement your own custom headless browserClient factory by implementing the IBrowserFactory interface and adding its implementation into services.
Constructors
BrowserRequestSender(BrowserConfiguration)
Initializes a new instance of the BrowserRequestSender class with the specified bowser configuration.
public BrowserRequestSender(BrowserConfiguration configuration)
Parameters
configuration
BrowserConfigurationThe browserClient configuration.
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 session.
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.