| Modifier and Type | Field and Description |
|---|---|
Boolean |
acceptDownloads
Whether to automatically download all the attachments.
|
Boolean |
bypassCSP
Toggles bypassing page's Content-Security-Policy.
|
ColorScheme |
colorScheme
Emulates
"prefers-colors-scheme" media feature, supported values are "light", "dark", "no-preference". |
Double |
deviceScaleFactor
Specify device scale factor (can be thought of as dpr).
|
Map<String,String> |
extraHTTPHeaders
An object containing additional HTTP headers to be sent with every request.
|
Geolocation |
geolocation |
Boolean |
hasTouch
Specifies if viewport supports touch events.
|
HttpCredentials |
httpCredentials
Credentials for HTTP authentication.
|
Boolean |
ignoreHTTPSErrors
Whether to ignore HTTPS errors during navigation.
|
Boolean |
isMobile
Whether the
meta viewport tag is taken into account and touch events are enabled. |
Boolean |
javaScriptEnabled
Whether or not to enable JavaScript in the context.
|
String |
locale
Specify user locale, for example
en-GB, de-DE, etc. |
Boolean |
offline
Whether to emulate network being offline.
|
List<String> |
permissions
A list of permissions to grant to all pages in this context.
|
Proxy |
proxy
Network proxy settings to use with this context.
|
Boolean |
recordHarOmitContent
Optional setting to control whether to omit request content from the HAR.
|
Path |
recordHarPath
Enables HAR recording for all pages into the specified HAR
file on the filesystem.
|
Path |
recordVideoDir
Enables video recording for all pages into the specified directory.
|
RecordVideoSize |
recordVideoSize
Dimensions of the recorded videos.
|
ScreenSize |
screenSize
Emulates consistent window screen size available inside web page via
window.screen. |
String |
storageState
Populates context with given storage state.
|
Path |
storageStatePath
Populates context with given storage state.
|
String |
timezoneId
Changes the timezone of the context.
|
String |
userAgent
Specific user agent to use in this context.
|
Optional<ViewportSize> |
viewportSize
Emulates consistent viewport for each page.
|
| Constructor and Description |
|---|
NewContextOptions() |
public Boolean acceptDownloads
false where all the downloads are canceled.public Boolean bypassCSP
public ColorScheme colorScheme
"prefers-colors-scheme" media feature, supported values are "light", "dark", "no-preference". See
Page.emulateMedia() for more details. Defaults to "light".public Double deviceScaleFactor
1.public Map<String,String> extraHTTPHeaders
public Geolocation geolocation
public Boolean hasTouch
public HttpCredentials httpCredentials
public Boolean ignoreHTTPSErrors
false.public Boolean isMobile
meta viewport tag is taken into account and touch events are enabled. Defaults to false. Not supported
in Firefox.public Boolean javaScriptEnabled
true.public String locale
en-GB, de-DE, etc. Locale will affect navigator.language value, Accept-Language
request header value as well as number and date formatting rules.public Boolean offline
false.public List<String> permissions
BrowserContext.grantPermissions() for more details.public Proxy proxy
NOTE: For Chromium on Windows the browser needs to be launched with the global proxy for this option to work. If all contexts
override the proxy, global proxy will be never used and can be any string, for example launch({ proxy: { server:
'http://per-context' } }).
public Boolean recordHarOmitContent
false.public Path recordHarPath
BrowserContext.close() for the HAR to be saved.public Path recordVideoDir
BrowserContext.close() for videos to be saved.public RecordVideoSize recordVideoSize
viewport scaled down to fit into
800x800. If viewport is not configured explicitly the video size defaults to 800x450. Actual picture of each page will
be scaled down if necessary to fit the specified size.public ScreenSize screenSize
window.screen. Is only used when the viewport
is set.public String storageState
BrowserContext.storageState().public Path storageStatePath
BrowserContext.storageState(). Path to the file with saved storage
state.public String timezoneId
public String userAgent
public Optional<ViewportSize> viewportSize
null disables the default viewport.public Browser.NewContextOptions setAcceptDownloads(boolean acceptDownloads)
public Browser.NewContextOptions setBypassCSP(boolean bypassCSP)
public Browser.NewContextOptions setColorScheme(ColorScheme colorScheme)
public Browser.NewContextOptions setDeviceScaleFactor(double deviceScaleFactor)
public Browser.NewContextOptions setExtraHTTPHeaders(Map<String,String> extraHTTPHeaders)
public Browser.NewContextOptions setGeolocation(double latitude, double longitude)
public Browser.NewContextOptions setGeolocation(Geolocation geolocation)
public Browser.NewContextOptions setHasTouch(boolean hasTouch)
public Browser.NewContextOptions setHttpCredentials(String username, String password)
public Browser.NewContextOptions setHttpCredentials(HttpCredentials httpCredentials)
public Browser.NewContextOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors)
public Browser.NewContextOptions setIsMobile(boolean isMobile)
public Browser.NewContextOptions setJavaScriptEnabled(boolean javaScriptEnabled)
public Browser.NewContextOptions setLocale(String locale)
public Browser.NewContextOptions setOffline(boolean offline)
public Browser.NewContextOptions setPermissions(List<String> permissions)
public Browser.NewContextOptions setProxy(String server)
public Browser.NewContextOptions setProxy(Proxy proxy)
public Browser.NewContextOptions setRecordHarOmitContent(boolean recordHarOmitContent)
public Browser.NewContextOptions setRecordHarPath(Path recordHarPath)
public Browser.NewContextOptions setRecordVideoDir(Path recordVideoDir)
public Browser.NewContextOptions setRecordVideoSize(int width, int height)
public Browser.NewContextOptions setRecordVideoSize(RecordVideoSize recordVideoSize)
public Browser.NewContextOptions setScreenSize(int width, int height)
public Browser.NewContextOptions setScreenSize(ScreenSize screenSize)
public Browser.NewContextOptions setStorageState(String storageState)
public Browser.NewContextOptions setStorageStatePath(Path storageStatePath)
public Browser.NewContextOptions setTimezoneId(String timezoneId)
public Browser.NewContextOptions setUserAgent(String userAgent)
public Browser.NewContextOptions setViewportSize(int width, int height)
public Browser.NewContextOptions setViewportSize(ViewportSize viewportSize)
Copyright © 2021. All rights reserved.