Members
id
- Source
Methods
(async) activate() → {Promise.<void>}
Activates and focuses the top-level browsing context.
- Source
If there is an error while activating the browsing context.
- Type
- Error
A promise that resolves when the browsing context is activated.
- Type:
- Promise.<void>
(async) back() → {Promise.<void>}
Navigates the browsing context to the previous page in the history.
- Source
A promise that resolves when the navigation is complete.
- Type:
- Promise.<void>
(async) captureElementScreenshot(sharedId, handleopt) → {Promise.<string>}
Captures a screenshot of a specific element within the browsing context.
Name | Type | Attributes | Description |
---|---|---|---|
sharedId | string | The shared ID of the element to capture. | |
handle | string | <optional> | The handle of the element to capture (optional). |
- Source
A promise that resolves to the base64-encoded screenshot data.
- Type:
- Promise.<string>
(async) captureScreenshot(captureScreenshotParametersopt) → {Promise.<string>}
Captures a screenshot of the browsing context.
Name | Type | Attributes | Description |
---|---|---|---|
captureScreenshotParameters | CaptureScreenshotParameters | | <optional> | Optional parameters for capturing the screenshot. |
- Source
- If the provided captureScreenshotParameters is not an instance of CaptureScreenshotParameters.
- A promise that resolves to the base64-encoded string representation of the captured screenshot.
- Type:
- Promise.<string>
(async) close() → {Promise.<void>}
Closes the browsing context
- Source
- Type:
- Promise.<void>
(async) create()
Creates a browsing context for the given type with the given parameters
- Source
(async) forward() → {Promise.<void>}
Moves the browsing context forward by one step in the history.
- Source
A promise that resolves when the browsing context has moved forward.
- Type:
- Promise.<void>
(async) getTopLevelContexts() → {Promise.<Array.<BrowsingContextInfo>>}
- Source
A Promise that resolves to an array of BrowsingContextInfo objects representing the top-level browsing contexts.
- Type:
- Promise.<Array.<BrowsingContextInfo>>
(async) getTree(maxDepth)
Name | Type | Description |
---|---|---|
maxDepth | the max depth of the descendents of browsing context tree |
- Source
BrowsingContextInfo object
(async) handleUserPrompt(acceptopt, userTextopt)
Handles a user prompt in the browsing context.
Name | Type | Attributes | Description |
---|---|---|---|
accept | boolean | <optional> | Optional. Indicates whether to accept or dismiss the prompt. |
userText | string | <optional> | Optional. The text to enter. |
- Source
If an error occurs while handling the user prompt.
- Type
- Error
(async) locateNode(locator, sandboxopt, serializationOptionsopt, startNodesopt) → {Promise.<RemoteValue>}
Locates a single node in the browsing context.
Name | Type | Attributes | Description |
---|---|---|---|
locator | Locator | The locator used to find the node. | |
sandbox | string | <optional> | The sandbox of the node (optional). |
serializationOptions | SerializationOptions | <optional> | The serialization options for the node (optional). |
startNodes | Array | <optional> | The starting nodes for the search (optional). |
- Source
- A promise that resolves to the located node.
- Type:
- Promise.<RemoteValue>
(async) locateNodes(locator, maxNodeCountopt, sandboxopt, serializationOptionsopt, startNodesopt) → {Promise.<Array.<RemoteValue>>}
Locates nodes in the browsing context.
Name | Type | Attributes | Description |
---|---|---|---|
locator | Locator | The locator object used to locate the nodes. | |
maxNodeCount | number | <optional> | The maximum number of nodes to locate (optional). |
sandbox | string | <optional> | The sandbox name for locating nodes (optional). |
serializationOptions | SerializationOptions | <optional> | The serialization options for locating nodes (optional). |
startNodes | Array.<ReferenceValue> | <optional> | The array of start nodes for locating nodes (optional). |
- Source
- If the locator is not an instance of Locator.
- Type
- Error
- If the serializationOptions is provided but not an instance of SerializationOptions.
- Type
- Error
- If the startNodes is provided but not an array of ReferenceValue objects.
- Type
- Error
- If any of the startNodes is not an instance of ReferenceValue.
- Type
- Error
- A promise that resolves to the arrays of located nodes.
- Type:
- Promise.<Array.<RemoteValue>>
(async) navigate(url, readinessState)
Name | Type | Description |
---|---|---|
url | the url to navigate to | |
readinessState | type of readiness state: "none" / "interactive" / "complete" |
- Source
NavigateResult object
(async) printPage(options)
Prints PDF of the webpage
Name | Type | Description |
---|---|---|
options | print options given by the user |
- Source
PrintResult object
(async) reload(ignoreCacheopt, readinessStateopt) → {Promise.<NavigateResult>}
Reloads the current browsing context.
Name | Type | Attributes | Description |
---|---|---|---|
ignoreCache | boolean | <optional> | Whether to ignore the cache when reloading. |
readinessState | string | <optional> | The readiness state to wait for before returning. Valid readiness states are 'none', 'interactive', and 'complete'. |
- Source
- If an invalid readiness state is provided.
- Type
- Error
- A promise that resolves to the result of the reload operation.
- Type:
- Promise.<NavigateResult>
(async) setViewport(width, height, devicePixelRatioopt)
Sets the viewport size and device pixel ratio for the browsing context.
Name | Type | Attributes | Description |
---|---|---|---|
width | number | The width of the viewport. | |
height | number | The height of the viewport. | |
devicePixelRatio | number | <optional> | The device pixel ratio (optional) |
- Source
If an error occurs while setting the viewport.
- Type
- Error
(async) traverseHistory(delta) → {Promise.<void>}
Traverses the browsing context history by a given delta.
Name | Type | Description |
---|---|---|
delta | number | The delta value to traverse the history. A positive value moves forward, while a negative value moves backward. |
- Source
- A promise that resolves when the history traversal is complete.
- Type:
- Promise.<void>