Table of Contents

Class APIRequestNewContextOptions

Namespace
Microsoft.Playwright
Assembly
Microsoft.Playwright.dll
public class APIRequestNewContextOptions
Inheritance
APIRequestNewContextOptions
Inherited Members

Constructors

APIRequestNewContextOptions()

public APIRequestNewContextOptions()

APIRequestNewContextOptions(APIRequestNewContextOptions)

public APIRequestNewContextOptions(APIRequestNewContextOptions clone)

Parameters

clone APIRequestNewContextOptions

Properties

BaseURL

Methods like GetAsync(string, APIRequestContextOptions?) take the base URL into consideration by using the URL() constructor for building the corresponding URL. Examples:

  • baseURL: http://localhost:3000 and sending request to /bar.html results in http://localhost:3000/bar.html
  • baseURL: http://localhost:3000/foo/ and sending request to ./bar.html results in http://localhost:3000/foo/bar.html
  • baseURL: http://localhost:3000/foo (without trailing slash) and navigating to ./bar.html results in http://localhost:3000/bar.html
[JsonPropertyName("baseURL")]
public string? BaseURL { get; set; }

Property Value

string

ExtraHTTPHeaders

An object containing additional HTTP headers to be sent with every request. Defaults to none.

[JsonPropertyName("extraHTTPHeaders")]
public IEnumerable<KeyValuePair<string, string>>? ExtraHTTPHeaders { get; set; }

Property Value

IEnumerable<KeyValuePair<string, string>>

HttpCredentials

Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.

[JsonPropertyName("httpCredentials")]
public HttpCredentials? HttpCredentials { get; set; }

Property Value

HttpCredentials

IgnoreHTTPSErrors

Whether to ignore HTTPS errors when sending network requests. Defaults to false.

[JsonPropertyName("ignoreHTTPSErrors")]
public bool? IgnoreHTTPSErrors { get; set; }

Property Value

bool?

Proxy

Network proxy settings.

[JsonPropertyName("proxy")]
public Proxy? Proxy { get; set; }

Property Value

Proxy

StorageState

Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via StorageStateAsync(BrowserContextStorageStateOptions?) or StorageStateAsync(APIRequestContextStorageStateOptions?). Either a path to the file with saved storage, or the value returned by one of StorageStateAsync(BrowserContextStorageStateOptions?) or StorageStateAsync(APIRequestContextStorageStateOptions?) methods.

[JsonPropertyName("storageState")]
public string? StorageState { get; set; }

Property Value

string

StorageStatePath

Populates context with given storage state. This option can be used to initialize context with logged-in information obtained via StorageStateAsync(BrowserContextStorageStateOptions?). Path to the file with saved storage state.

[JsonPropertyName("storageStatePath")]
public string? StorageStatePath { get; set; }

Property Value

string

Timeout

Maximum time in milliseconds to wait for the response. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.

[JsonPropertyName("timeout")]
public float? Timeout { get; set; }

Property Value

float?

UserAgent

Specific user agent to use in this context.

[JsonPropertyName("userAgent")]
public string? UserAgent { get; set; }

Property Value

string