class Playwright::Browser::NewContextOptions
- Playwright::Browser::NewContextOptions
- Reference
- Object
Included Modules
- JSON::Serializable
Defined in:
playwright/browser.crConstructors
- .new(pull : JSON::PullParser)
- .new(accept_downloads : Bool | Nil = nil, ignore_https_errors : Bool | Nil = nil, bypass_csp : Bool | Nil = nil, viewport : Nil | Playwright::Page::ViewPort = nil, user_agent : Nil | String = nil, device_scale_factor : Int32 | Nil = nil, is_mobile : Bool | Nil = nil, has_touch : Bool | Nil = nil, java_script_enabled : Bool | Nil = nil, timezone_id : Nil | String = nil, geolocation : Nil | Playwright::Geolocation = nil, locale : Nil | String = nil, permissions : Nil | Array(String) = nil, extra_http_headers : Nil | Hash(String, String) = nil, offline : Bool | Nil = nil, http_credentials : Nil | Playwright::BrowserContext::HTTPCredentials = nil, color_scheme : Playwright::ColorScheme | Nil = nil, logger : Playwright::Logger | Nil = nil, record_har : Nil | Playwright::Browser::NewContextOptions::RecordHar = nil, record_video : Nil | Playwright::Browser::NewContextOptions::RecordVideo = nil, proxy : Nil | Playwright::Browser::NewContextOptions::Proxy = nil, storage_state : Nil | Playwright::BrowserContext::StorageState = nil)
Instance Method Summary
-
#accept_downloads : Bool | Nil
Whether to automatically download all the attachments.
-
#accept_downloads=(accept_downloads : Bool | Nil)
Whether to automatically download all the attachments.
-
#bypass_csp : Bool | Nil
Toggles bypassing page's Content-Security-Policy.
-
#bypass_csp=(bypass_csp : Bool | Nil)
Toggles bypassing page's Content-Security-Policy.
-
#color_scheme : ColorScheme | Nil
Emulates
'prefers-colors-scheme'
media feature, supported values are'light'
,'dark'
,'no-preference'
. -
#color_scheme=(color_scheme : ColorScheme | Nil)
Emulates
'prefers-colors-scheme'
media feature, supported values are'light'
,'dark'
,'no-preference'
. -
#device_scale_factor : Int32 | Nil
Specify device scale factor (can be thought of as dpr).
-
#device_scale_factor=(device_scale_factor : Int32 | Nil)
Specify device scale factor (can be thought of as dpr).
-
#extra_http_headers : Hash(String, String) | Nil
An object containing additional HTTP headers to be sent with every request.
-
#extra_http_headers=(extra_http_headers : Hash(String, String) | Nil)
An object containing additional HTTP headers to be sent with every request.
- #geolocation : Geolocation | Nil
- #geolocation=(geolocation : Geolocation | Nil)
-
#has_touch : Bool | Nil
Specifies if viewport supports touch events.
-
#has_touch=(has_touch : Bool | Nil)
Specifies if viewport supports touch events.
-
#http_credentials : BrowserContext::HTTPCredentials | Nil
Credentials for HTTP authentication.
-
#http_credentials=(http_credentials : BrowserContext::HTTPCredentials | Nil)
Credentials for HTTP authentication.
-
#ignore_https_errors : Bool | Nil
Whether to ignore HTTPS errors during navigation.
-
#ignore_https_errors=(ignore_https_errors : Bool | Nil)
Whether to ignore HTTPS errors during navigation.
-
#is_mobile : Bool | Nil
Whether the
meta viewport
tag is taken into account and touch events are enabled. -
#is_mobile=(is_mobile : Bool | Nil)
Whether the
meta viewport
tag is taken into account and touch events are enabled. -
#java_script_enabled : Bool | Nil
Whether or not to enable JavaScript in the context.
-
#java_script_enabled=(java_script_enabled : Bool | Nil)
Whether or not to enable JavaScript in the context.
-
#locale : String | Nil
Specify user locale, for example
en-GB
,de-DE
, etc. -
#locale=(locale : String | Nil)
Specify user locale, for example
en-GB
,de-DE
, etc. -
#logger : Logger | Nil
Logger sink for Playwright logging.
-
#logger=(logger : Logger | Nil)
Logger sink for Playwright logging.
-
#offline : Bool | Nil
Whether to emulate network being offline.
-
#offline=(offline : Bool | Nil)
Whether to emulate network being offline.
-
#permissions : Array(String) | Nil
A list of permissions to grant to all pages in this context.
-
#permissions=(permissions : Array(String) | Nil)
A list of permissions to grant to all pages in this context.
-
#proxy : Proxy | Nil
Network proxy settings to use with this context.
-
#proxy=(proxy : Proxy | Nil)
Network proxy settings to use with this context.
-
#record_har : RecordHar | Nil
Enables HAR recording for all pages into
recordHar.path
file. -
#record_har=(record_har : RecordHar | Nil)
Enables HAR recording for all pages into
recordHar.path
file. -
#record_video : RecordVideo | Nil
Enables video recording for all pages into
recordVideo.dir
directory. -
#record_video=(record_video : RecordVideo | Nil)
Enables video recording for all pages into
recordVideo.dir
directory. -
#storage_state : BrowserContext::StorageState | Nil
Populates context with given storage state.
-
#storage_state=(storage_state : BrowserContext::StorageState | Nil)
Populates context with given storage state.
- #storage_state_path : Path | Nil
- #storage_state_path=(storage_state_path : Path | Nil)
-
#timezone_id : String | Nil
Changes the timezone of the context.
-
#timezone_id=(timezone_id : String | Nil)
Changes the timezone of the context.
-
#user_agent : String | Nil
Specific user agent to use in this context.
-
#user_agent=(user_agent : String | Nil)
Specific user agent to use in this context.
-
#viewport : Page::ViewPort | Nil
Sets a consistent viewport for each page.
-
#viewport=(viewport : Page::ViewPort | Nil)
Sets a consistent viewport for each page.
- #with_storage_state(path : Path)
- #with_storage_state(state : BrowserContext::StorageState)
Constructor Detail
Instance Method Detail
Whether to automatically download all the attachments. Defaults to false
where all the downloads are canceled.
Whether to automatically download all the attachments. Defaults to false
where all the downloads are canceled.
Emulates 'prefers-colors-scheme'
media feature, supported values are 'light'
, 'dark'
, 'no-preference'
. See page.emulateMedia(params)
for more details. Defaults to 'light
'.
Emulates 'prefers-colors-scheme'
media feature, supported values are 'light'
, 'dark'
, 'no-preference'
. See page.emulateMedia(params)
for more details. Defaults to 'light
'.
Specify device scale factor (can be thought of as dpr). Defaults to 1
.
Specify device scale factor (can be thought of as dpr). Defaults to 1
.
An object containing additional HTTP headers to be sent with every request. All header values must be strings.
An object containing additional HTTP headers to be sent with every request. All header values must be strings.
Specifies if viewport supports touch events. Defaults to false.
Credentials for HTTP authentication.
Whether to ignore HTTPS errors during navigation. Defaults to false
.
Whether to ignore HTTPS errors during navigation. Defaults to false
.
Whether the meta viewport
tag is taken into account and touch events are enabled. Defaults to false
. Not supported in Firefox.
Whether the meta viewport
tag is taken into account and touch events are enabled. Defaults to false
. Not supported in Firefox.
Whether or not to enable JavaScript in the context. Defaults to true
.
Whether or not to enable JavaScript in the context. Defaults to true
.
Specify user locale, for example en-GB
, de-DE
, etc. Locale will affect navigator.language
value, Accept-Language
request header value as well as number and date formatting rules.
Specify user locale, for example en-GB
, de-DE
, etc. Locale will affect navigator.language
value, Accept-Language
request header value as well as number and date formatting rules.
A list of permissions to grant to all pages in this context. See browserContext.grantPermissions(permissions[, options])
for more details.
A list of permissions to grant to all pages in this context. See browserContext.grantPermissions(permissions[, options])
for more details.
Network proxy settings to use with this context. Note that 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: 'per-context' } })
.
Network proxy settings to use with this context. Note that 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: 'per-context' } })
.
Enables HAR recording for all pages into recordHar.path
file. If not specified, the HAR is not recorded. Make sure to await browserContext.close()
for the HAR to be saved.
Enables HAR recording for all pages into recordHar.path
file. If not specified, the HAR is not recorded. Make sure to await browserContext.close()
for the HAR to be saved.
Enables video recording for all pages into recordVideo.dir
directory. If not specified videos are not recorded. Make sure to await browserContext.close()
for videos to be saved.
Enables video recording for all pages into recordVideo.dir
directory. If not specified videos are not recorded. Make sure to await browserContext.close()
for videos to be saved.
Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via browserContext.storageState([options])
. Either a path to the file with saved storage, or an object with the following fields:
Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via browserContext.storageState([options])
. Either a path to the file with saved storage, or an object with the following fields:
Changes the timezone of the context. See ICU’s metaZones.txt
for a list of supported timezone IDs.
Changes the timezone of the context. See ICU’s metaZones.txt
for a list of supported timezone IDs.
Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. null
disables the default viewport.
Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. null
disables the default viewport.