Package com.microsoft.playwright
Class APIRequest.NewContextOptions
- java.lang.Object
-
- com.microsoft.playwright.APIRequest.NewContextOptions
-
- Enclosing interface:
- APIRequest
public static class APIRequest.NewContextOptions extends Object
-
-
Field Summary
Fields Modifier and Type Field Description StringbaseURLMethods likeAPIRequestContext.get()take the base URL into consideration by using theURL()constructor for building the corresponding URL.Map<String,String>extraHTTPHeadersAn object containing additional HTTP headers to be sent with every request.HttpCredentialshttpCredentialsCredentials for HTTP authentication.BooleanignoreHTTPSErrorsWhether to ignore HTTPS errors when sending network requests.ProxyproxyNetwork proxy settings.StringstorageStatePopulates context with given storage state.PathstorageStatePathPopulates context with given storage state.DoubletimeoutMaximum time in milliseconds to wait for the response.StringuserAgentSpecific user agent to use in this context.
-
Constructor Summary
Constructors Constructor Description NewContextOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description APIRequest.NewContextOptionssetBaseURL(String baseURL)Methods likeAPIRequestContext.get()take the base URL into consideration by using theURL()constructor for building the corresponding URL.APIRequest.NewContextOptionssetExtraHTTPHeaders(Map<String,String> extraHTTPHeaders)An object containing additional HTTP headers to be sent with every request.APIRequest.NewContextOptionssetHttpCredentials(HttpCredentials httpCredentials)Credentials for HTTP authentication.APIRequest.NewContextOptionssetHttpCredentials(String username, String password)Credentials for HTTP authentication.APIRequest.NewContextOptionssetIgnoreHTTPSErrors(boolean ignoreHTTPSErrors)Whether to ignore HTTPS errors when sending network requests.APIRequest.NewContextOptionssetProxy(Proxy proxy)Network proxy settings.APIRequest.NewContextOptionssetProxy(String server)Network proxy settings.APIRequest.NewContextOptionssetStorageState(String storageState)Populates context with given storage state.APIRequest.NewContextOptionssetStorageStatePath(Path storageStatePath)Populates context with given storage state.APIRequest.NewContextOptionssetTimeout(double timeout)Maximum time in milliseconds to wait for the response.APIRequest.NewContextOptionssetUserAgent(String userAgent)Specific user agent to use in this context.
-
-
-
Field Detail
-
baseURL
public String 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
public Map<String,String> extraHTTPHeaders
An object containing additional HTTP headers to be sent with every request. Defaults to none.
-
httpCredentials
public HttpCredentials httpCredentials
Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
-
ignoreHTTPSErrors
public Boolean ignoreHTTPSErrors
Whether to ignore HTTPS errors when sending network requests. Defaults tofalse.
-
proxy
public Proxy proxy
Network proxy settings.
-
storageState
public String 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
public Path 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
public Double timeout
Maximum time in milliseconds to wait for the response. Defaults to30000(30 seconds). Pass0to disable timeout.
-
userAgent
public String userAgent
Specific user agent to use in this context.
-
-
Method Detail
-
setBaseURL
public APIRequest.NewContextOptions setBaseURL(String 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:
-
setExtraHTTPHeaders
public APIRequest.NewContextOptions setExtraHTTPHeaders(Map<String,String> extraHTTPHeaders)
An object containing additional HTTP headers to be sent with every request. Defaults to none.
-
setHttpCredentials
public APIRequest.NewContextOptions setHttpCredentials(String username, String password)
Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
-
setHttpCredentials
public APIRequest.NewContextOptions setHttpCredentials(HttpCredentials httpCredentials)
Credentials for HTTP authentication. If no origin is specified, the username and password are sent to any servers upon unauthorized responses.
-
setIgnoreHTTPSErrors
public APIRequest.NewContextOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors)
Whether to ignore HTTPS errors when sending network requests. Defaults tofalse.
-
setProxy
public APIRequest.NewContextOptions setProxy(String server)
Network proxy settings.
-
setProxy
public APIRequest.NewContextOptions setProxy(Proxy proxy)
Network proxy settings.
-
setStorageState
public APIRequest.NewContextOptions setStorageState(String 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.
-
setStorageStatePath
public APIRequest.NewContextOptions setStorageStatePath(Path 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.
-
setTimeout
public APIRequest.NewContextOptions setTimeout(double timeout)
Maximum time in milliseconds to wait for the response. Defaults to30000(30 seconds). Pass0to disable timeout.
-
setUserAgent
public APIRequest.NewContextOptions setUserAgent(String userAgent)
Specific user agent to use in this context.
-
-