Package com.microsoft.playwright
Class APIRequest.NewContextOptions
java.lang.Object
com.microsoft.playwright.APIRequest.NewContextOptions
- Enclosing interface:
APIRequest
-
Field Summary
FieldsModifier and TypeFieldDescriptionMethods likeAPIRequestContext.get()take the base URL into consideration by using theURL()constructor for building the corresponding URL.An object containing additional HTTP headers to be sent with every request.Credentials for HTTP authentication.Whether to ignore HTTPS errors when sending network requests.Network proxy settings.Populates context with given storage state.Populates context with given storage state.Maximum time in milliseconds to wait for the response.Specific user agent to use in this context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetBaseURL(String baseURL) Methods likeAPIRequestContext.get()take the base URL into consideration by using theURL()constructor for building the corresponding URL.setExtraHTTPHeaders(Map<String, String> extraHTTPHeaders) An object containing additional HTTP headers to be sent with every request.setHttpCredentials(HttpCredentials httpCredentials) Credentials for HTTP authentication.setHttpCredentials(String username, String password) Credentials for HTTP authentication.setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) Whether to ignore HTTPS errors when sending network requests.Network proxy settings.Network proxy settings.setStorageState(String storageState) Populates context with given storage state.setStorageStatePath(Path storageStatePath) Populates context with given storage state.setTimeout(double timeout) Maximum time in milliseconds to wait for the response.setUserAgent(String userAgent) Specific user agent to use in this context.
-
Field Details
-
baseURL
Methods likeAPIRequestContext.get()take the base URL into consideration by using theURL()constructor for building the corresponding URL. Examples:- baseURL:
http://localhost:3000and sending request to/bar.htmlresults inhttp://localhost:3000/bar.html - baseURL:
http://localhost:3000/foo/and sending request to./bar.htmlresults inhttp://localhost:3000/foo/bar.html - baseURL:
http://localhost:3000/foo(without trailing slash) and navigating to./bar.htmlresults inhttp://localhost:3000/bar.html
- baseURL:
-
extraHTTPHeaders
An object containing additional HTTP headers to be sent with every request. Defaults to none. -
httpCredentials
Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses. -
ignoreHTTPSErrors
Whether to ignore HTTPS errors when sending network requests. Defaults tofalse. -
proxy
Network proxy settings. -
storageState
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained viaBrowserContext.storageState()orAPIRequestContext.storageState(). Either a path to the file with saved storage, or the value returned by one ofBrowserContext.storageState()orAPIRequestContext.storageState()methods. -
storageStatePath
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained viaBrowserContext.storageState(). Path to the file with saved storage state. -
timeout
Maximum time in milliseconds to wait for the response. Defaults to30000(30 seconds). Pass0to disable timeout. -
userAgent
Specific user agent to use in this context.
-
-
Constructor Details
-
NewContextOptions
public NewContextOptions()
-
-
Method Details
-
setBaseURL
Methods likeAPIRequestContext.get()take the base URL into consideration by using theURL()constructor for building the corresponding URL. Examples:- baseURL:
http://localhost:3000and sending request to/bar.htmlresults inhttp://localhost:3000/bar.html - baseURL:
http://localhost:3000/foo/and sending request to./bar.htmlresults inhttp://localhost:3000/foo/bar.html - baseURL:
http://localhost:3000/foo(without trailing slash) and navigating to./bar.htmlresults inhttp://localhost:3000/bar.html
- baseURL:
-
setExtraHTTPHeaders
An object containing additional HTTP headers to be sent with every request. Defaults to none. -
setHttpCredentials
Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses. -
setHttpCredentials
Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses. -
setIgnoreHTTPSErrors
Whether to ignore HTTPS errors when sending network requests. Defaults tofalse. -
setProxy
Network proxy settings. -
setProxy
Network proxy settings. -
setStorageState
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained viaBrowserContext.storageState()orAPIRequestContext.storageState(). Either a path to the file with saved storage, or the value returned by one ofBrowserContext.storageState()orAPIRequestContext.storageState()methods. -
setStorageStatePath
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained viaBrowserContext.storageState(). Path to the file with saved storage state. -
setTimeout
Maximum time in milliseconds to wait for the response. Defaults to30000(30 seconds). Pass0to disable timeout. -
setUserAgent
Specific user agent to use in this context.
-