waitUntil
<[WaitUntilEnum]<"load"|"domcontentloaded"|"networkidle">>
When to consider operation succeeded, defaults to load
. Events can be either:
'domcontentloaded'
- consider operation to be finished when theDOMContentLoaded
event is fired.'load'
- consider operation to be finished when theload
event is fired.'networkidle'
- consider operation to be finished when there are no network connections for at least500
ms.
timeout
<[float]>
Maximum operation time in milliseconds, defaults to 30 seconds, pass 0
to disable timeout.
The default value can be changed by using the
[method: BrowserContext.setDefaultNavigationTimeout
],
[method: BrowserContext.setDefaultTimeout
],
[method: Page.setDefaultNavigationTimeout
] or
[method: Page.setDefaultTimeout
] methods.
timeout
<[float]>
maximum time to wait for in milliseconds. Defaults to 30000
(30 seconds). Pass 0
to disable timeout. The default
value can be changed by using the [method: BrowserContext.setDefaultTimeout
].
timeout
<[float]>
Maximum time in milliseconds, defaults to 30 seconds, pass 0
to disable timeout. The default value can be changed by
using the [method: BrowserContext.setDefaultTimeout
] or
[method: Page.setDefaultTimeout
] methods.
noWaitAfter
<[boolean]>
Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating
to inaccessible pages. Defaults to false
.
force
<[boolean]>
Whether to bypass the actionability checks. Defaults to false
.
selector
<[string]>
A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See working with selectors for more details.
position
<[Object]>x
<[float]>y
<[float]>
A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the element.
modifiers
<[Array]<[ModifierEnum]<"Alt"|"Control"|"Meta"|"Shift">>>
Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
button
<[ButtonEnum]<"left"|"right"|"middle">>
Defaults to left
.
files
<[path]|[Array]<[path]>|[Object]|[Array]<[Object]>>name
<[string]> [File] namemimeType
<[string]> [File] typebuffer
<[Buffer]> File content
delay
<[float]>
Time to wait between mousedown
and mouseup
in milliseconds. Defaults to 0.
clickCount
<[int]>
defaults to 1. See [UIEvent.detail].
selector
<[string]>
A selector to query for. See working with selectors for more details.
state
<[ElementStateEnum]<"attached"|"detached"|"visible"|"hidden">>
Defaults to 'visible'
. Can be either:
'attached'
- wait for element to be present in DOM.'detached'
- wait for element to not be present in DOM.'visible'
- wait for element to have non-empty bounding box and novisibility:hidden
. Note that element without any content or withdisplay:none
has an empty bounding box and is not considered visible.'hidden'
- wait for element to be either detached from DOM, or have an empty bounding box orvisibility:hidden
. This is opposite to the'visible'
option.
- langs: js, python
ignoreDefaultArgs
<[boolean]|[Array]<[string]>>
If true
, Playwright does not pass its own configurations args and only uses the ones from [option: args
]. If an
array is given, then filters out the given default arguments. Dangerous option; use with care. Defaults to false
.
- langs: csharp, java
ignoreDefaultArgs
<[Array]<[string]>>
If true
, Playwright does not pass its own configurations args and only uses the ones from [option: args
].
Dangerous option; use with care.
- langs: csharp, java
ignoreAllDefaultArgs
<[boolean]>
If true
, Playwright does not pass its own configurations args and only uses the ones from [option: args
].
Dangerous option; use with care. Defaults to false
.
proxy
<[Object]>server
<[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for examplehttp://myproxy.com:3128
orsocks5://myproxy.com:3128
. Short formmyproxy.com:3128
is considered an HTTP proxy.bypass
<[string]> Optional coma-separated domains to bypass proxy, for example".com, chromium.org, .domain.com"
.username
<[string]> Optional username to use if HTTP proxy requires authentication.password
<[string]> Optional password to use if HTTP proxy requires authentication.
Network proxy settings.
- langs: csharp, java
env
<[Object]<[string], [string]>>
Specify environment variables that will be visible to the browser. Defaults to process.env
.
- langs: js, python
env
<[Object]<[string], [string]|[float]|[boolean]>>
Specify environment variables that will be visible to the browser. Defaults to process.env
.
- langs: js, python
storageState
<[path]|[Object]>cookies
<[Array]<[Object]>> Optional cookies to set for contextname
<[string]>value
<[string]>url
<[string]> Optional either url or domain / path are requireddomain
<[string]> Optional either url or domain / path are requiredpath
<[string]> Optional either url or domain / path are requiredexpires
<[float]> Optional Unix time in seconds.httpOnly
<[boolean]> Optional httpOnly flagsecure
<[boolean]> Optional secure flagsameSite
<"Strict"|"Lax"|"None"> Optional sameSite flag
origins
<[Array]<[Object]>> Optional localStorage to set for contextorigin
<[string]>localStorage
<[Array]<[Object]>>name
<[string]>value
<[string]>
Populates context with given storage state. This option can be used to initialize context with logged-in information
obtained via [method: BrowserContext.storageState
]. Either a path to the file with saved storage, or an object with the following fields:
- langs: csharp, java
storageState
<[string]>
Populates context with given storage state. This option can be used to initialize context with logged-in information
obtained via [method: BrowserContext.storageState
].
- langs: csharp, java
storageStatePath
<[path]>
Populates context with given storage state. This option can be used to initialize context with logged-in information
obtained via [method: BrowserContext.storageState
]. Path to the file with saved storage state.
acceptDownloads
<[boolean]>
Whether to automatically download all the attachments. Defaults to false
where all the downloads are canceled.
ignoreHTTPSErrors
<[boolean]>
Whether to ignore HTTPS errors during navigation. Defaults to false
.
bypassCSP
<[boolean]>
Toggles bypassing page's Content-Security-Policy.
- langs: java, js
viewport
<[null]|[Object]>width
<[int]> page width in pixels.height
<[int]> page height in pixels.
Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. null
disables the default viewport.
expression
<[string]>
JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted as a function. Otherwise, evaluated as an expression.
- langs: js
pageFunction
<[function]|[string]>
Function to be evaluated in the page context.
- langs: js
pageFunction
<[function]([Element])>
Function to be evaluated in the page context.
- langs: js
pageFunction
<[function]([Array]<[Element]>)>
Function to be evaluated in the page context.
- langs: js
pageFunction
<[function]|[string]>
Function to be evaluated in the worker context.
- langs: js
pageFunction
<[function]|[Electron]>
Function to be evaluated in the worker context.
- langs: python
viewport
<[null]|[Object]>width
<[int]> page width in pixels.height
<[int]> page height in pixels.
Sets a consistent viewport for each page. Defaults to an 1280x720 viewport. no_viewport
disables the fixed viewport.
- langs: python
noViewport
<[boolean]>
Does not enforce fixed viewport, allows resizing window in the headed mode.
userAgent
<[string]>
Specific user agent to use in this context.
deviceScaleFactor
<[float]>
Specify device scale factor (can be thought of as dpr). Defaults to 1
.
isMobile
<[boolean]>
Whether the meta viewport
tag is taken into account and touch events are enabled. Defaults to false
. Not supported
in Firefox.
hasTouch
<[boolean]>
Specifies if viewport supports touch events. Defaults to false.
javaScriptEnabled
<[boolean]>
Whether or not to enable JavaScript in the context. Defaults to true
.
timezoneId
<[string]>
Changes the timezone of the context. See ICU's metaZones.txt for a list of supported timezone IDs.
geolocation
<[Object]>latitude
<[float]> Latitude between -90 and 90.longitude
<[float]> Longitude between -180 and 180.accuracy
<[float]> Non-negative accuracy value. Defaults to0
.
locale
<[string]>
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.
permissions
<[Array]<[string]>>
A list of permissions to grant to all pages in this context. See
[method: BrowserContext.grantPermissions
] for more details.
extraHTTPHeaders
<[Object]<[string], [string]>>
An object containing additional HTTP headers to be sent with every request. All header values must be strings.
offline
<[boolean]>
Whether to emulate network being offline. Defaults to false
.
httpCredentials
<[Object]>username
<[string]>password
<[string]>
Credentials for HTTP authentication.
colorScheme
<[ColorSchemeEnum]<"light"|"dark"|"no-preference">>
Emulates 'prefers-colors-scheme'
media feature, supported values are 'light'
, 'dark'
, 'no-preference'
. See
[method: Page.emulateMedia
] for more details. Defaults to 'light
'.
- langs: js
logger
<[Logger]>
Logger sink for Playwright logging.
- langs: js
videosPath
<[path]>
DEPRECATED Use [option: recordVideo
] instead.
- langs: js
videoSize
<[Object]>width
<[int]> Video frame width.height
<[int]> Video frame height.
DEPRECATED Use [option: recordVideo
] instead.
- langs: java, js
recordHar
<[Object]>omitContent
<[boolean]> Optional setting to control whether to omit request content from the HAR. Defaults tofalse
.path
<[path]> Path on the filesystem to write the HAR file to.
Enables HAR recording for all pages into recordHar.path
file. If not
specified, the HAR is not recorded. Make sure to await [method: BrowserContext.close
] for the HAR to be
saved.
- langs: python
record_har_omit_content
<[boolean]>
Optional setting to control whether to omit request content from the HAR. Defaults to false
.
- langs: python
record_har_path
<[path]>
Path on the filesystem to write the HAR file to.
- langs: java, js
recordVideo
<[Object]>dir
<[path]> Path to the directory to put videos into.size
<[Object]> Optional dimensions of the recorded videos. If not specified the size will be equal toviewport
. Ifviewport
is not configured explicitly the video size defaults to 1280x720. Actual picture of each page will be scaled down if necessary to fit the specified size.width
<[int]> Video frame width.height
<[int]> Video frame height.
Enables video recording for all pages into recordVideo.dir
directory. If not specified videos are not recorded. Make
sure to await [method: BrowserContext.close
] for videos to be saved.
- langs: python
record_video_dir
<[path]>
Path to the directory to put videos into.
- langs: python
record_video_size
<[Object]> Ifviewport
is not configured explicitly the video size defaults to 1280x720. Actual picture of each page will be scaled down if necessary to fit the specified size.width
<[int]> Video frame width.height
<[int]> Video frame height.
Optional dimensions of the recorded videos. If not specified the size will be equal to viewport
.
proxy
<[Object]>server
<[string]> Proxy to be used for all requests. HTTP and SOCKS proxies are supported, for examplehttp://myproxy.com:3128
orsocks5://myproxy.com:3128
. Short formmyproxy.com:3128
is considered an HTTP proxy.bypass
<[string]> Optional coma-separated domains to bypass proxy, for example".com, chromium.org, .domain.com"
.username
<[string]> Optional username to use if HTTP proxy requires authentication.password
<[string]> Optional password to use if HTTP proxy requires authentication.
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' } })
.
- langs: java, js
values
<[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>>value
<[string]> Matches byoption.value
. Optional.label
<[string]> Matches byoption.label
. Optional.index
<[int]> Matches by the index. Optional.
Options to select. If the <select>
has the multiple
attribute, all matching options are selected, otherwise only the
first option matching one of the passed options is selected. String values are equivalent to {value:'string'}
. Option
is considered matching if all specified properties match.
url
<[string]|[RegExp]|[function]([URL]):[boolean]>
A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
event
<[string]>
Event name, same one typically passed into *.on(event)
.
state
<[LoadStateEnum]<"load"|"domcontentloaded"|"networkidle">>
Optional load state to wait for, defaults to load
. If the state has been already reached while loading current document, the
method resolves immediately. Can be one of:
'load'
- wait for theload
event to be fired.'domcontentloaded'
- wait for theDOMContentLoaded
event to be fired.'networkidle'
- wait until there are no network connections for at least500
ms.
type
<[ScreenshotTypeEnum]<"png"|"jpeg">>
Specify screenshot type, defaults to png
.
- langs: java
callback
<[Runnable]>
Callback that performs the action triggering the event.
- langs: python
element
<[ElementHandle]|[Array]<[ElementHandle]>>
Option elements to select. Optional.
- langs: python
index
<[int]|[Array]<[int]>>
Options to select by index. Optional.
- langs: python
value
<[string]|[Array]<[string]>>
Options to select by value. If the <select>
has the multiple
attribute, all given options are selected, otherwise
only the first option matching one of the passed options is selected. Optional.
- langs: python
label
<[string]|[Array]<[string]>>
Options to select by label. If the <select>
has the multiple
attribute, all given options are selected, otherwise
only the first option matching one of the passed options is selected. Optional.
- langs: python
predicate
<[function]>
Receives the event data and resolves to truthy value when the waiting should resolve.
- langs: csharp, java, python
timeout
<[float]>
Maximum time to wait for in milliseconds. Defaults to 30000
(30 seconds). Pass 0
to disable timeout.
The default value can be changed by using the [method: BrowserContext.setDefaultTimeout
].
- %%-context-option-acceptdownloads-%%
- %%-context-option-ignorehttpserrors-%%
- %%-context-option-bypasscsp-%%
- %%-context-option-viewport-%%
- %%-python-context-option-viewport-%%
- %%-python-context-option-no-viewport-%%
- %%-context-option-useragent-%%
- %%-context-option-devicescalefactor-%%
- %%-context-option-ismobile-%%
- %%-context-option-hastouch-%%
- %%-context-option-javascriptenabled-%%
- %%-context-option-timezoneid-%%
- %%-context-option-geolocation-%%
- %%-context-option-locale-%%
- %%-context-option-permissions-%%
- %%-context-option-extrahttpheaders-%%
- %%-context-option-offline-%%
- %%-context-option-httpcredentials-%%
- %%-context-option-colorscheme-%%
- %%-context-option-logger-%%
- %%-context-option-videospath-%%
- %%-context-option-videosize-%%
- %%-context-option-recordhar-%%
- %%-python-context-option-recordhar-path-%%
- %%-python-context-option-recordhar-omit-content-%%
- %%-context-option-recordvideo-%%
- %%-python-context-option-recordvideo-dir-%%
- %%-python-context-option-recordvideo-size-%%