PageOptions
Input options for configuring a Page when it’s created or navigated via the ‘page’ query. These options allow customization of various browser features and page behaviors.
Definition
Fields
acceptDownloads
: Boolean
Whether to automatically accept and download all files triggered by links or scripts. Defaults to false. If true, downloads are automatically handled.
authentication
: AuthCredentialOptions
Credentials for HTTP Basic Authentication.
Provide username, password, and optionally the origin for which these credentials apply.
See AuthCredentialOptions
for structure.
Example: { username: "user", password: "password123" }
blockAds
: BlockAdsOptions
Options to block categories of web resources like ads, trackers, or annoyances.
See BlockAdsOptions
for enabling specific categories.
Example: { ads: true, tracking: true }
blockRequests
: BlockRequestsOptions
Options to block network requests based on their resource type.
See BlockRequestsOptions
for specifying resource types to block (e.g., IMAGE, SCRIPT).
Example: { resourceTypes: [IMAGE, STYLESHEET] }
bypassCSP
: Boolean
Whether to bypass the page’s Content Security Policy (CSP). Defaults to false. Setting to true can be useful for testing or when CSP interferes with automation scripts.
defaultNavigationTimeout
: Int
Maximum navigation timeout in milliseconds for the page. If a navigation takes longer than this, it will fail. Overrides any global default. Set to 0 to disable the timeout.
defaultTimeout
: Int
Default maximum time in milliseconds for actions (like clicks, fills) on the page. Defaults to 10000 (10 seconds). Set to 0 to disable the timeout.
device
: Device
The name of a device to emulate, chosen from a predefined list. See Device
enum.
This sets viewport size, user agent, touch support, etc., to match the specified device.
Example: IPHONE_13_PRO_MAX
emulateMedia
: EmulateMediaOptions
Options to emulate media features like color scheme, contrast, or print media type.
See EmulateMediaOptions
for details (e.g., { media: PRINT, colorScheme: DARK }
).
geolocation
: GeolocationOptions
Sets the geolocation of the page. See GeolocationOptions
for latitude, longitude, and accuracy.
Example: { latitude: 51.5074, longitude: -0.1278 }
(London)
extraHTTPHeaders
: Headers
Additional HTTP headers to be sent with every request made by this page.
Provided as a JSON object of header name-value pairs.
Example: { "X-Custom-Auth": "some_token", "Accept-Language": "en-US" }
ignoreHTTPSErrors
: Boolean
Whether to ignore HTTPS errors during navigation (e.g., from self-signed certificates). Defaults to false. Use with caution.
javaScriptEnabled
: Boolean
Whether JavaScript is enabled on the page. Defaults to true. Setting to false can speed up loading for some pages or test non-JavaScript experiences.
locale
: String
Specifies the user locale for the page, affecting language, date formatting, etc.
Should be a BCP 47 language tag. Example: "en-US"
, "fr-FR"
, "ja-JP"
.
permissions
: [Permission]
A list of browser permissions to grant to the page upon creation. See Permission
enum.
Example: [GEOLOCATION, CAMERA]
proxy
: ProxyOptions
Network proxy settings for the page. See ProxyOptions
for server, username, password, and bypass list.
Example: { server: "http://myproxy.com:3128", username: "user", password: "proxyPassword" }
referer
: String
The Referer HTTP header value to send with navigations initiated by this page.
Example: "https://www.google.com/"
screen
: ScreenOptions
Screen size to emulate for the page, in pixels. See ScreenOptions
for width and height.
This is different from viewport size; it represents the physical screen dimensions.
Example: { width: 1920, height: 1080 }
serviceWorkers
: ServiceWorkerRegistration
Policy for handling service workers on the page. See ServiceWorkerRegistration
enum (ALLOW or BLOCK).
Defaults to ALLOW.
storageState
: StorageStateOptions
Initial storage state (cookies, local storage, IndexedDB) for the page.
See StorageStateOptions
for the structure. Useful for restoring a previous session.
timeout
: Int
Maximum navigation time in milliseconds for the initial page load. Defaults to 30000 (30 seconds). Set to 0 to disable the timeout. This is specific to the ‘page’ query’s initial navigation.
timezoneId
: String
Changes the timezone of the page. Should be a valid IANA timezone ID.
Example: "America/New_York"
, "Europe/London"
, "Asia/Tokyo"
.
userAgent
: String
User agent string to use for the page. Overrides the default or device-specific user agent.
Example: "Mozilla/5.0 (compatible; MyCustomAgent/1.0)"
viewport
: ViewportOptions
Viewport dimensions and settings for the page. See ViewportOptions
for width and height.
Example: { width: 1280, height: 720 }
waitUntil
: LifecycleEvent
When to consider the initial navigation successful. See LifecycleEvent
enum.
Defaults to an appropriate value like NETWORK_IDLE or LOAD.
Example: DOM_CONTENT_LOADED