Class BrowserClient
This class represents a client that can interact with a web application using a browser, such as Chromium, Firefox, or WebKit. It uses the Playwright library to create and control the browser instance. Upon instantiation, the ownership of the Browser and BrowserContext objects is transferred to BrowserResponseMessage class, which then becomes responsible for managing and releasing the browser resources appropriately.
public class BrowserClient
  - Inheritance
 - 
      
      BrowserClient
 
- Inherited Members
 
Constructors
BrowserClient(IBrowser, BrowserConfiguration)
Initializes a new instance with the specified browser and configuration parameter. A browser Microsoft.Playwright.IBrowser object represents the headless browser instance. It can be obtained from the IPlaywright interface.
public BrowserClient(IBrowser browser, BrowserConfiguration configuration)
  Parameters
browserIBrowserThe browser instance.
configurationBrowserConfigurationThe browser configuration instance.
Properties
Browser
Returns a browser instance.
public IBrowser Browser { get; }
  Property Value
- IBrowser
 
Name
A read-only property that gets the name of the headless browser type, such as "chromium", "firefox", or "webkit".
public string Name { get; }
  Property Value
Version
A read-only property that gets the version of the headless browser instance.
public string Version { get; }
  Property Value
Methods
SendAsync(Uri, CancellationToken)
An asynchronous method that sends an HTTP request to the specified URL and returns a BrowserResponseMessage object that represents the response, if the operation completes successfully. The BrowserResponseMessage object provides methods and properties to access and manipulate the web page content and functionality.
public Task<BrowserResponseMessage?> SendAsync(Uri url, CancellationToken cancellationToken = default)
  Parameters
urlUriA Uri object that represents the URL of the web page to request.
cancellationTokenCancellationTokenAn optional CancellationToken object that can be used to cancel this operation. If the operation is cancelled, the method may return null.
Returns
- Task<BrowserResponseMessage>
 A Task<BrowserResponseMessage?> object that represents the asynchronous operation. The result of the task is a BrowserResponseMessage object that represents the web page response, or null if the operation is cancelled before completion.
SendAsync(Uri, IHttpRequestInterceptor, CancellationToken)
An asynchronous method that sends an HTTP request to the specified URL and returns a BrowserResponseMessage object that represents the response, if the operation completes successfully. The BrowserResponseMessage object provides methods and properties to access and manipulate the web page content and functionality.
public Task<BrowserResponseMessage?> SendAsync(Uri url, IHttpRequestInterceptor requestInterceptor, CancellationToken cancellationToken = default)
  Parameters
urlUriA Uri object that represents the URL of the web page to request.
requestInterceptorIHttpRequestInterceptorThe interceptor that can modify or handle the request before it is sent.
cancellationTokenCancellationTokenAn optional CancellationToken object that can be used to cancel this operation. If the operation is cancelled, the method may return null.
Returns
- Task<BrowserResponseMessage>
 A Task<BrowserResponseMessage?> object that represents the asynchronous operation. The result of the task is a BrowserResponseMessage object that represents the web page response, or null if the operation is cancelled before completion.
SendAsync(Uri, IHttpResponseHandler, CancellationToken)
An asynchronous method that sends an HTTP request to the specified URL and returns a BrowserResponseMessage object that represents the response, if the operation completes successfully. The BrowserResponseMessage object provides methods and properties to access and manipulate the web page content and functionality.
public Task<BrowserResponseMessage?> SendAsync(Uri url, IHttpResponseHandler handler, CancellationToken cancellationToken = default)
  Parameters
urlUriA Uri object that represents the URL of the web page to request.
handlerIHttpResponseHandlerA handler that will be invoked when an HTTP response is received.
cancellationTokenCancellationTokenAn optional CancellationToken object that can be used to cancel this operation. If the operation is cancelled, the method may return null.
Returns
- Task<BrowserResponseMessage>
 A Task<BrowserResponseMessage?> object that represents the asynchronous operation. The result of the task is a BrowserResponseMessage object that represents the web page response, or null if the operation is cancelled before completion.
SendAsync(Uri, IHttpResponseHandler, IHttpRequestInterceptor, CancellationToken)
An asynchronous method that sends an HTTP request to the specified URL and returns a BrowserResponseMessage object that represents the response, if the operation completes successfully. The BrowserResponseMessage object provides methods and properties to access and manipulate the web page content and functionality.
public Task<BrowserResponseMessage?> SendAsync(Uri url, IHttpResponseHandler handler, IHttpRequestInterceptor requestInterceptor, CancellationToken cancellationToken = default)
  Parameters
urlUriA Uri object that represents the URL of the web page to request.
handlerIHttpResponseHandlerA handler that will be invoked when an HTTP response is received.
requestInterceptorIHttpRequestInterceptorThe interceptor that can modify or handle the request before it is sent.
cancellationTokenCancellationTokenAn optional CancellationToken object that can be used to cancel this operation. If the operation is cancelled, the method may return null.
Returns
- Task<BrowserResponseMessage>
 A Task<BrowserResponseMessage?> object that represents the asynchronous operation. The result of the task is a BrowserResponseMessage object that represents the web page response, or null if the operation is cancelled before completion.