Class Browser.NewPageOptions
- java.lang.Object
-
- com.microsoft.playwright.Browser.NewPageOptions
-
-
Field Summary
Fields Modifier and Type Field Description Boolean
acceptDownloads
Whether to automatically download all the attachments.String
baseURL
When usingPage.navigate()
,Page.route()
,Page.waitForURL()
,Page.waitForRequest()
, orPage.waitForResponse()
it takes the base URL in consideration by using theURL()
constructor for building the corresponding URL.Boolean
bypassCSP
Toggles bypassing page's Content-Security-Policy.List<ClientCertificate>
clientCertificates
TLS Client Authentication allows the server to request a client certificate and verify it.Optional<ColorScheme>
colorScheme
Optional<Contrast>
contrast
Emulates"prefers-contrast"
media feature, supported values are"no-preference"
,"more"
.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.Optional<ForcedColors>
forcedColors
Emulates"forced-colors"
media feature, supported values are"active"
,"none"
.Geolocation
geolocation
Boolean
hasTouch
Specifies if viewport supports touch events.HttpCredentials
httpCredentials
Credentials for HTTP authentication.Boolean
ignoreHTTPSErrors
Whether to ignore HTTPS errors when sending network requests.Boolean
isMobile
Whether themeta viewport
tag is taken into account and touch events are enabled. isMobile is a part of device, so you don't actually need to set it manually.Boolean
javaScriptEnabled
Whether or not to enable JavaScript in the context.String
locale
Specify user locale, for exampleen-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.HarContentPolicy
recordHarContent
Optional setting to control resource content management.HarMode
recordHarMode
When set tominimal
, only record information necessary for routing from HAR.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.Object
recordHarUrlFilter
Path
recordVideoDir
Enables video recording for all pages into the specified directory.RecordVideoSize
recordVideoSize
Dimensions of the recorded videos.Optional<ReducedMotion>
reducedMotion
Emulates"prefers-reduced-motion"
media feature, supported values are"reduce"
,"no-preference"
.ScreenSize
screenSize
Emulates consistent window screen size available inside web page viawindow.screen
.ServiceWorkerPolicy
serviceWorkers
Whether to allow sites to register Service workers.String
storageState
Populates context with given storage state.Path
storageStatePath
Populates context with given storage state.Boolean
strictSelectors
If set to true, enables strict selectors mode for this context.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 Summary
Constructors Constructor Description NewPageOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Browser.NewPageOptions
setAcceptDownloads(boolean acceptDownloads)
Whether to automatically download all the attachments.Browser.NewPageOptions
setBaseURL(String baseURL)
When usingPage.navigate()
,Page.route()
,Page.waitForURL()
,Page.waitForRequest()
, orPage.waitForResponse()
it takes the base URL in consideration by using theURL()
constructor for building the corresponding URL.Browser.NewPageOptions
setBypassCSP(boolean bypassCSP)
Toggles bypassing page's Content-Security-Policy.Browser.NewPageOptions
setClientCertificates(List<ClientCertificate> clientCertificates)
TLS Client Authentication allows the server to request a client certificate and verify it.Browser.NewPageOptions
setColorScheme(ColorScheme colorScheme)
Browser.NewPageOptions
setContrast(Contrast contrast)
Emulates"prefers-contrast"
media feature, supported values are"no-preference"
,"more"
.Browser.NewPageOptions
setDeviceScaleFactor(double deviceScaleFactor)
Specify device scale factor (can be thought of as dpr).Browser.NewPageOptions
setExtraHTTPHeaders(Map<String,String> extraHTTPHeaders)
An object containing additional HTTP headers to be sent with every request.Browser.NewPageOptions
setForcedColors(ForcedColors forcedColors)
Emulates"forced-colors"
media feature, supported values are"active"
,"none"
.Browser.NewPageOptions
setGeolocation(double latitude, double longitude)
Browser.NewPageOptions
setGeolocation(Geolocation geolocation)
Browser.NewPageOptions
setHasTouch(boolean hasTouch)
Specifies if viewport supports touch events.Browser.NewPageOptions
setHttpCredentials(HttpCredentials httpCredentials)
Credentials for HTTP authentication.Browser.NewPageOptions
setHttpCredentials(String username, String password)
Credentials for HTTP authentication.Browser.NewPageOptions
setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors)
Whether to ignore HTTPS errors when sending network requests.Browser.NewPageOptions
setIsMobile(boolean isMobile)
Whether themeta viewport
tag is taken into account and touch events are enabled. isMobile is a part of device, so you don't actually need to set it manually.Browser.NewPageOptions
setJavaScriptEnabled(boolean javaScriptEnabled)
Whether or not to enable JavaScript in the context.Browser.NewPageOptions
setLocale(String locale)
Specify user locale, for exampleen-GB
,de-DE
, etc.Browser.NewPageOptions
setOffline(boolean offline)
Whether to emulate network being offline.Browser.NewPageOptions
setPermissions(List<String> permissions)
A list of permissions to grant to all pages in this context.Browser.NewPageOptions
setProxy(Proxy proxy)
Network proxy settings to use with this context.Browser.NewPageOptions
setProxy(String server)
Network proxy settings to use with this context.Browser.NewPageOptions
setRecordHarContent(HarContentPolicy recordHarContent)
Optional setting to control resource content management.Browser.NewPageOptions
setRecordHarMode(HarMode recordHarMode)
When set tominimal
, only record information necessary for routing from HAR.Browser.NewPageOptions
setRecordHarOmitContent(boolean recordHarOmitContent)
Optional setting to control whether to omit request content from the HAR.Browser.NewPageOptions
setRecordHarPath(Path recordHarPath)
Enables HAR recording for all pages into the specified HAR file on the filesystem.Browser.NewPageOptions
setRecordHarUrlFilter(String recordHarUrlFilter)
Browser.NewPageOptions
setRecordHarUrlFilter(Pattern recordHarUrlFilter)
Browser.NewPageOptions
setRecordVideoDir(Path recordVideoDir)
Enables video recording for all pages into the specified directory.Browser.NewPageOptions
setRecordVideoSize(int width, int height)
Dimensions of the recorded videos.Browser.NewPageOptions
setRecordVideoSize(RecordVideoSize recordVideoSize)
Dimensions of the recorded videos.Browser.NewPageOptions
setReducedMotion(ReducedMotion reducedMotion)
Emulates"prefers-reduced-motion"
media feature, supported values are"reduce"
,"no-preference"
.Browser.NewPageOptions
setScreenSize(int width, int height)
Emulates consistent window screen size available inside web page viawindow.screen
.Browser.NewPageOptions
setScreenSize(ScreenSize screenSize)
Emulates consistent window screen size available inside web page viawindow.screen
.Browser.NewPageOptions
setServiceWorkers(ServiceWorkerPolicy serviceWorkers)
Whether to allow sites to register Service workers.Browser.NewPageOptions
setStorageState(String storageState)
Populates context with given storage state.Browser.NewPageOptions
setStorageStatePath(Path storageStatePath)
Populates context with given storage state.Browser.NewPageOptions
setStrictSelectors(boolean strictSelectors)
If set to true, enables strict selectors mode for this context.Browser.NewPageOptions
setTimezoneId(String timezoneId)
Changes the timezone of the context.Browser.NewPageOptions
setUserAgent(String userAgent)
Specific user agent to use in this context.Browser.NewPageOptions
setViewportSize(int width, int height)
Emulates consistent viewport for each page.Browser.NewPageOptions
setViewportSize(ViewportSize viewportSize)
Emulates consistent viewport for each page.
-
-
-
Field Detail
-
acceptDownloads
public Boolean acceptDownloads
Whether to automatically download all the attachments. Defaults totrue
where all the downloads are accepted.
-
baseURL
public String baseURL
When usingPage.navigate()
,Page.route()
,Page.waitForURL()
,Page.waitForRequest()
, orPage.waitForResponse()
it takes the base URL in consideration by using theURL()
constructor for building the corresponding URL. Unset by default. Examples:- baseURL:
http://localhost:3000
and navigating to/bar.html
results inhttp://localhost:3000/bar.html
- baseURL:
http://localhost:3000/foo/
and navigating to./bar.html
results inhttp://localhost:3000/foo/bar.html
- baseURL:
http://localhost:3000/foo
(without trailing slash) and navigating to./bar.html
results inhttp://localhost:3000/bar.html
- baseURL:
-
bypassCSP
public Boolean bypassCSP
Toggles bypassing page's Content-Security-Policy. Defaults tofalse
.
-
clientCertificates
public List<ClientCertificate> clientCertificates
TLS Client Authentication allows the server to request a client certificate and verify it.Details
An array of client certificates to be used. Each certificate object must have either both
certPath
andkeyPath
, a singlepfxPath
, or their corresponding direct value equivalents (cert
andkey
, orpfx
). Optionally,passphrase
property should be provided if the certificate is encrypted. Theorigin
property should be provided with an exact match to the request origin that the certificate is valid for.NOTE: When using WebKit on macOS, accessing
localhost
will not pick up client certificates. You can make it work by replacinglocalhost
withlocal.playwright
.
-
colorScheme
public Optional<ColorScheme> colorScheme
Emulates prefers-colors-scheme media feature, supported values are"light"
and"dark"
. SeePage.emulateMedia()
for more details. Passingnull
resets emulation to system defaults. Defaults to"light"
.
-
contrast
public Optional<Contrast> contrast
Emulates"prefers-contrast"
media feature, supported values are"no-preference"
,"more"
. SeePage.emulateMedia()
for more details. Passingnull
resets emulation to system defaults. Defaults to"no-preference"
.
-
deviceScaleFactor
public Double deviceScaleFactor
Specify device scale factor (can be thought of as dpr). Defaults to1
. Learn more about emulating devices with device scale factor.
-
extraHTTPHeaders
public Map<String,String> extraHTTPHeaders
An object containing additional HTTP headers to be sent with every request. Defaults to none.
-
forcedColors
public Optional<ForcedColors> forcedColors
Emulates"forced-colors"
media feature, supported values are"active"
,"none"
. SeePage.emulateMedia()
for more details. Passingnull
resets emulation to system defaults. Defaults to"none"
.
-
geolocation
public Geolocation geolocation
-
hasTouch
public Boolean hasTouch
Specifies if viewport supports touch events. Defaults to false. Learn more about mobile emulation.
-
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
.
-
isMobile
public Boolean isMobile
Whether themeta viewport
tag is taken into account and touch events are enabled. isMobile is a part of device, so you don't actually need to set it manually. Defaults tofalse
and is not supported in Firefox. Learn more about mobile emulation.
-
javaScriptEnabled
public Boolean javaScriptEnabled
Whether or not to enable JavaScript in the context. Defaults totrue
. Learn more about disabling JavaScript.
-
locale
public String locale
Specify user locale, for exampleen-GB
,de-DE
, etc. Locale will affectnavigator.language
value,Accept-Language
request header value as well as number and date formatting rules. Defaults to the system default locale. Learn more about emulation in our emulation guide.
-
offline
public Boolean offline
Whether to emulate network being offline. Defaults tofalse
. Learn more about network emulation.
-
permissions
public List<String> permissions
A list of permissions to grant to all pages in this context. SeeBrowserContext.grantPermissions()
for more details. Defaults to none.
-
proxy
public Proxy proxy
Network proxy settings to use with this context. Defaults to none.
-
recordHarContent
public HarContentPolicy recordHarContent
Optional setting to control resource content management. Ifomit
is specified, content is not persisted. Ifattach
is specified, resources are persisted as separate files and all of these files are archived along with the HAR file. Defaults toembed
, which stores content inline the HAR file as per HAR specification.
-
recordHarMode
public HarMode recordHarMode
When set tominimal
, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults tofull
.
-
recordHarOmitContent
public Boolean recordHarOmitContent
Optional setting to control whether to omit request content from the HAR. Defaults tofalse
.
-
recordHarPath
public Path recordHarPath
Enables HAR recording for all pages into the specified HAR file on the filesystem. If not specified, the HAR is not recorded. Make sure to callBrowserContext.close()
for the HAR to be saved.
-
recordHarUrlFilter
public Object recordHarUrlFilter
-
recordVideoDir
public Path recordVideoDir
Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure to callBrowserContext.close()
for videos to be saved.
-
recordVideoSize
public RecordVideoSize recordVideoSize
Dimensions of the recorded videos. If not specified the size will be equal toviewport
scaled down to fit into 800x800. Ifviewport
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.
-
reducedMotion
public Optional<ReducedMotion> reducedMotion
Emulates"prefers-reduced-motion"
media feature, supported values are"reduce"
,"no-preference"
. SeePage.emulateMedia()
for more details. Passingnull
resets emulation to system defaults. Defaults to"no-preference"
.
-
screenSize
public ScreenSize screenSize
Emulates consistent window screen size available inside web page viawindow.screen
. Is only used when theviewport
is set.
-
serviceWorkers
public ServiceWorkerPolicy serviceWorkers
Whether to allow sites to register Service workers. Defaults to"allow"
.-
"allow"
: Service Workers can be registered. -
"block"
: Playwright will block all registration of Service Workers.
-
-
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()
.
-
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.
-
strictSelectors
public Boolean strictSelectors
If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. This option does not affect any Locator APIs (Locators are always strict). Defaults tofalse
. SeeLocator
to learn more about the strict mode.
-
timezoneId
public String timezoneId
Changes the timezone of the context. See ICU's metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone.
-
userAgent
public String userAgent
Specific user agent to use in this context.
-
viewportSize
public Optional<ViewportSize> viewportSize
Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Usenull
to disable the consistent viewport emulation. Learn more about viewport emulation.NOTE: The
null
value opts out from the default presets, makes viewport depend on the host window size defined by the operating system. It makes the execution of the tests non-deterministic.
-
-
Method Detail
-
setAcceptDownloads
public Browser.NewPageOptions setAcceptDownloads(boolean acceptDownloads)
Whether to automatically download all the attachments. Defaults totrue
where all the downloads are accepted.
-
setBaseURL
public Browser.NewPageOptions setBaseURL(String baseURL)
When usingPage.navigate()
,Page.route()
,Page.waitForURL()
,Page.waitForRequest()
, orPage.waitForResponse()
it takes the base URL in consideration by using theURL()
constructor for building the corresponding URL. Unset by default. Examples:- baseURL:
http://localhost:3000
and navigating to/bar.html
results inhttp://localhost:3000/bar.html
- baseURL:
http://localhost:3000/foo/
and navigating to./bar.html
results inhttp://localhost:3000/foo/bar.html
- baseURL:
http://localhost:3000/foo
(without trailing slash) and navigating to./bar.html
results inhttp://localhost:3000/bar.html
- baseURL:
-
setBypassCSP
public Browser.NewPageOptions setBypassCSP(boolean bypassCSP)
Toggles bypassing page's Content-Security-Policy. Defaults tofalse
.
-
setClientCertificates
public Browser.NewPageOptions setClientCertificates(List<ClientCertificate> clientCertificates)
TLS Client Authentication allows the server to request a client certificate and verify it.Details
An array of client certificates to be used. Each certificate object must have either both
certPath
andkeyPath
, a singlepfxPath
, or their corresponding direct value equivalents (cert
andkey
, orpfx
). Optionally,passphrase
property should be provided if the certificate is encrypted. Theorigin
property should be provided with an exact match to the request origin that the certificate is valid for.NOTE: When using WebKit on macOS, accessing
localhost
will not pick up client certificates. You can make it work by replacinglocalhost
withlocal.playwright
.
-
setColorScheme
public Browser.NewPageOptions setColorScheme(ColorScheme colorScheme)
Emulates prefers-colors-scheme media feature, supported values are"light"
and"dark"
. SeePage.emulateMedia()
for more details. Passingnull
resets emulation to system defaults. Defaults to"light"
.
-
setContrast
public Browser.NewPageOptions setContrast(Contrast contrast)
Emulates"prefers-contrast"
media feature, supported values are"no-preference"
,"more"
. SeePage.emulateMedia()
for more details. Passingnull
resets emulation to system defaults. Defaults to"no-preference"
.
-
setDeviceScaleFactor
public Browser.NewPageOptions setDeviceScaleFactor(double deviceScaleFactor)
Specify device scale factor (can be thought of as dpr). Defaults to1
. Learn more about emulating devices with device scale factor.
-
setExtraHTTPHeaders
public Browser.NewPageOptions setExtraHTTPHeaders(Map<String,String> extraHTTPHeaders)
An object containing additional HTTP headers to be sent with every request. Defaults to none.
-
setForcedColors
public Browser.NewPageOptions setForcedColors(ForcedColors forcedColors)
Emulates"forced-colors"
media feature, supported values are"active"
,"none"
. SeePage.emulateMedia()
for more details. Passingnull
resets emulation to system defaults. Defaults to"none"
.
-
setGeolocation
public Browser.NewPageOptions setGeolocation(double latitude, double longitude)
-
setGeolocation
public Browser.NewPageOptions setGeolocation(Geolocation geolocation)
-
setHasTouch
public Browser.NewPageOptions setHasTouch(boolean hasTouch)
Specifies if viewport supports touch events. Defaults to false. Learn more about mobile emulation.
-
setHttpCredentials
public Browser.NewPageOptions 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 Browser.NewPageOptions 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 Browser.NewPageOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors)
Whether to ignore HTTPS errors when sending network requests. Defaults tofalse
.
-
setIsMobile
public Browser.NewPageOptions setIsMobile(boolean isMobile)
Whether themeta viewport
tag is taken into account and touch events are enabled. isMobile is a part of device, so you don't actually need to set it manually. Defaults tofalse
and is not supported in Firefox. Learn more about mobile emulation.
-
setJavaScriptEnabled
public Browser.NewPageOptions setJavaScriptEnabled(boolean javaScriptEnabled)
Whether or not to enable JavaScript in the context. Defaults totrue
. Learn more about disabling JavaScript.
-
setLocale
public Browser.NewPageOptions setLocale(String locale)
Specify user locale, for exampleen-GB
,de-DE
, etc. Locale will affectnavigator.language
value,Accept-Language
request header value as well as number and date formatting rules. Defaults to the system default locale. Learn more about emulation in our emulation guide.
-
setOffline
public Browser.NewPageOptions setOffline(boolean offline)
Whether to emulate network being offline. Defaults tofalse
. Learn more about network emulation.
-
setPermissions
public Browser.NewPageOptions setPermissions(List<String> permissions)
A list of permissions to grant to all pages in this context. SeeBrowserContext.grantPermissions()
for more details. Defaults to none.
-
setProxy
public Browser.NewPageOptions setProxy(String server)
Network proxy settings to use with this context. Defaults to none.
-
setProxy
public Browser.NewPageOptions setProxy(Proxy proxy)
Network proxy settings to use with this context. Defaults to none.
-
setRecordHarContent
public Browser.NewPageOptions setRecordHarContent(HarContentPolicy recordHarContent)
Optional setting to control resource content management. Ifomit
is specified, content is not persisted. Ifattach
is specified, resources are persisted as separate files and all of these files are archived along with the HAR file. Defaults toembed
, which stores content inline the HAR file as per HAR specification.
-
setRecordHarMode
public Browser.NewPageOptions setRecordHarMode(HarMode recordHarMode)
When set tominimal
, only record information necessary for routing from HAR. This omits sizes, timing, page, cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults tofull
.
-
setRecordHarOmitContent
public Browser.NewPageOptions setRecordHarOmitContent(boolean recordHarOmitContent)
Optional setting to control whether to omit request content from the HAR. Defaults tofalse
.
-
setRecordHarPath
public Browser.NewPageOptions setRecordHarPath(Path recordHarPath)
Enables HAR recording for all pages into the specified HAR file on the filesystem. If not specified, the HAR is not recorded. Make sure to callBrowserContext.close()
for the HAR to be saved.
-
setRecordHarUrlFilter
public Browser.NewPageOptions setRecordHarUrlFilter(String recordHarUrlFilter)
-
setRecordHarUrlFilter
public Browser.NewPageOptions setRecordHarUrlFilter(Pattern recordHarUrlFilter)
-
setRecordVideoDir
public Browser.NewPageOptions setRecordVideoDir(Path recordVideoDir)
Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure to callBrowserContext.close()
for videos to be saved.
-
setRecordVideoSize
public Browser.NewPageOptions setRecordVideoSize(int width, int height)
Dimensions of the recorded videos. If not specified the size will be equal toviewport
scaled down to fit into 800x800. Ifviewport
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.
-
setRecordVideoSize
public Browser.NewPageOptions setRecordVideoSize(RecordVideoSize recordVideoSize)
Dimensions of the recorded videos. If not specified the size will be equal toviewport
scaled down to fit into 800x800. Ifviewport
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.
-
setReducedMotion
public Browser.NewPageOptions setReducedMotion(ReducedMotion reducedMotion)
Emulates"prefers-reduced-motion"
media feature, supported values are"reduce"
,"no-preference"
. SeePage.emulateMedia()
for more details. Passingnull
resets emulation to system defaults. Defaults to"no-preference"
.
-
setScreenSize
public Browser.NewPageOptions setScreenSize(int width, int height)
Emulates consistent window screen size available inside web page viawindow.screen
. Is only used when theviewport
is set.
-
setScreenSize
public Browser.NewPageOptions setScreenSize(ScreenSize screenSize)
Emulates consistent window screen size available inside web page viawindow.screen
. Is only used when theviewport
is set.
-
setServiceWorkers
public Browser.NewPageOptions setServiceWorkers(ServiceWorkerPolicy serviceWorkers)
Whether to allow sites to register Service workers. Defaults to"allow"
.-
"allow"
: Service Workers can be registered. -
"block"
: Playwright will block all registration of Service Workers.
-
-
setStorageState
public Browser.NewPageOptions setStorageState(String storageState)
Populates context with given storage state. This option can be used to initialize context with logged-in information obtained viaBrowserContext.storageState()
.
-
setStorageStatePath
public Browser.NewPageOptions 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.
-
setStrictSelectors
public Browser.NewPageOptions setStrictSelectors(boolean strictSelectors)
If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors that imply single target DOM element will throw when more than one element matches the selector. This option does not affect any Locator APIs (Locators are always strict). Defaults tofalse
. SeeLocator
to learn more about the strict mode.
-
setTimezoneId
public Browser.NewPageOptions setTimezoneId(String timezoneId)
Changes the timezone of the context. See ICU's metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone.
-
setUserAgent
public Browser.NewPageOptions setUserAgent(String userAgent)
Specific user agent to use in this context.
-
setViewportSize
public Browser.NewPageOptions setViewportSize(int width, int height)
Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Usenull
to disable the consistent viewport emulation. Learn more about viewport emulation.NOTE: The
null
value opts out from the default presets, makes viewport depend on the host window size defined by the operating system. It makes the execution of the tests non-deterministic.
-
setViewportSize
public Browser.NewPageOptions setViewportSize(ViewportSize viewportSize)
Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Usenull
to disable the consistent viewport emulation. Learn more about viewport emulation.NOTE: The
null
value opts out from the default presets, makes viewport depend on the host window size defined by the operating system. It makes the execution of the tests non-deterministic.
-
-