| 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 |
|---|
NewPageOptions() |
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.NewPageOptions setAcceptDownloads(boolean acceptDownloads)
public Browser.NewPageOptions setBypassCSP(boolean bypassCSP)
public Browser.NewPageOptions setColorScheme(ColorScheme colorScheme)
public Browser.NewPageOptions setDeviceScaleFactor(double deviceScaleFactor)
public Browser.NewPageOptions setExtraHTTPHeaders(Map<String,String> extraHTTPHeaders)
public Browser.NewPageOptions setGeolocation(double latitude, double longitude)
public Browser.NewPageOptions setGeolocation(Geolocation geolocation)
public Browser.NewPageOptions setHasTouch(boolean hasTouch)
public Browser.NewPageOptions setHttpCredentials(String username, String password)
public Browser.NewPageOptions setHttpCredentials(HttpCredentials httpCredentials)
public Browser.NewPageOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors)
public Browser.NewPageOptions setIsMobile(boolean isMobile)
public Browser.NewPageOptions setJavaScriptEnabled(boolean javaScriptEnabled)
public Browser.NewPageOptions setLocale(String locale)
public Browser.NewPageOptions setOffline(boolean offline)
public Browser.NewPageOptions setPermissions(List<String> permissions)
public Browser.NewPageOptions setProxy(String server)
public Browser.NewPageOptions setProxy(Proxy proxy)
public Browser.NewPageOptions setRecordHarOmitContent(boolean recordHarOmitContent)
public Browser.NewPageOptions setRecordHarPath(Path recordHarPath)
public Browser.NewPageOptions setRecordVideoDir(Path recordVideoDir)
public Browser.NewPageOptions setRecordVideoSize(int width, int height)
public Browser.NewPageOptions setRecordVideoSize(RecordVideoSize recordVideoSize)
public Browser.NewPageOptions setScreenSize(int width, int height)
public Browser.NewPageOptions setScreenSize(ScreenSize screenSize)
public Browser.NewPageOptions setStorageState(String storageState)
public Browser.NewPageOptions setStorageStatePath(Path storageStatePath)
public Browser.NewPageOptions setTimezoneId(String timezoneId)
public Browser.NewPageOptions setUserAgent(String userAgent)
public Browser.NewPageOptions setViewportSize(int width, int height)
public Browser.NewPageOptions setViewportSize(ViewportSize viewportSize)
Copyright © 2021. All rights reserved.