PageSession

A session created when attaching to a target of type Page.

The subset of domains available for this target type is not strictly defined by the protocol. The subset provided in this interface is guaranteed to work on this target type. However, some domains might be missing in this interface while being effectively supported by the target. If this is the case, you can use the unsafe function to access all domains.

As a subinterface of PageTarget, it inherits the generated domain properties that match the latest Chrome DevToolsProtocol definitions. As such, it is not stable for inheritance, as new properties can be added without major version bump when the protocol changes. It is however safe to use all non-experimental and non-deprecated domains defined here. The experimental and deprecation cycles of the protocol are reflected in this interface with the same guarantees.

Properties

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
abstract val audits: AuditsDomain

Audits domain allows investigation of page violations and possible improvements.

Link copied to clipboard

Defines events for background web platform features.

Link copied to clipboard
abstract val browser: BrowserDomain

The Browser domain defines methods and events for browser managing.

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
abstract val css: CSSDomain

This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associated id used in subsequent operations on the related object. Each object type has a specific id structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the get*ForNode() calls (which accept a DOM node id). A client can also keep track of stylesheets via the styleSheetAdded/styleSheetRemoved events and subsequently load the required stylesheet contents using the getStyleSheet[Text]() methods.

Link copied to clipboard
abstract val database: DatabaseDomain

(undocumented in the protocol definition)

Link copied to clipboard
abstract val debugger: DebuggerDomain

Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
abstract val dom: DOMDomain

This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an id. This id can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client. Note that iframe owner elements will return corresponding document elements as their child nodes.

Link copied to clipboard

DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript execution will stop on these operations as if there was a regular breakpoint set.

Link copied to clipboard

This domain facilitates obtaining document snapshots with DOM, layout, and style information.

Link copied to clipboard

Query and modify DOM storage.

Link copied to clipboard

This domain emulates different environments for the page.

Link copied to clipboard
abstract val fedCm: FedCmDomain

This domain allows interacting with the FedCM dialog.

Link copied to clipboard
abstract val fetch: FetchDomain

A domain for letting clients substitute browser's network layer with client code.

Link copied to clipboard

This domain provides experimental commands only supported in headless mode.

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
abstract val input: InputDomain

(undocumented in the protocol definition)

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
abstract val io: IODomain

Input/Output operations for streams produced by DevTools.

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
abstract val log: LogDomain

Provides access to log entries.

Link copied to clipboard
abstract val memory: MemoryDomain

(undocumented in the protocol definition)

Link copied to clipboard

Info about this session and its underlying target.

Link copied to clipboard
abstract val network: NetworkDomain

Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.

Link copied to clipboard
abstract val overlay: OverlayDomain

This domain provides various functionality related to drawing atop the inspected page.

Link copied to clipboard
abstract val page: PageDomain

Actions and events related to the inspected page belong to the page domain.

Link copied to clipboard
abstract val parent: BrowserSession

The parent browser session that created this target session.

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
abstract val preload: PreloadDomain

(undocumented in the protocol definition)

Link copied to clipboard
abstract val profiler: ProfilerDomain

(undocumented in the protocol definition)

Link copied to clipboard
abstract val runtime: RuntimeDomain

Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.

Link copied to clipboard
abstract val schema: SchemaDomain

This domain is deprecated.

Link copied to clipboard
abstract val security: SecurityDomain

Security

Link copied to clipboard

(undocumented in the protocol definition)

Link copied to clipboard
abstract val storage: StorageDomain

(undocumented in the protocol definition)

Link copied to clipboard

The SystemInfo domain defines methods and events for querying low-level system information.

Link copied to clipboard
abstract val target: TargetDomain

Supports additional targets discovery and allows to attach to them.

Link copied to clipboard
abstract val tracing: TracingDomain

(undocumented in the protocol definition)

Link copied to clipboard
abstract val webAuthn: WebAuthnDomain

This domain allows configuring virtual authenticators to test the WebAuthn API.

Functions

Link copied to clipboard

Adapts this ChildSession to a AuctionWorkletSession. If the attached target is not of a compatible type, this function throws an exception.

Link copied to clipboard

Adapts this ChildSession to a PageSession. If the attached target is not of a compatible type, this function throws an exception.

Link copied to clipboard

Adapts this ChildSession to a ServiceWorkerSession. If the attached target is not of a compatible type, this function throws an exception.

Link copied to clipboard

Adapts this ChildSession to a SharedStorageWorkletSession. If the attached target is not of a compatible type, this function throws an exception.

Link copied to clipboard

Adapts this ChildSession to a SharedWorkerSession. If the attached target is not of a compatible type, this function throws an exception.

Link copied to clipboard

Adapts this ChildSession to a WebContentsSession. If the attached target is not of a compatible type, this function throws an exception.

Link copied to clipboard

Adapts this ChildSession to a WorkerSession. If the attached target is not of a compatible type, this function throws an exception.

Link copied to clipboard

Adapts this ChildSession to a WorkletSession. If the attached target is not of a compatible type, this function throws an exception.

Link copied to clipboard

Finds page targets that were opened by this page.

Link copied to clipboard
suspend fun PageSession.clickOnElement(selector: CssSelector, clickDurationMillis: Long, mouseButton: MouseButton = MouseButton.left)
suspend fun PageSession.clickOnElement(selector: CssSelector, clickDuration: Duration = 100.milliseconds, mouseButton: MouseButton = MouseButton.left)

Finds a DOM element via the given selector, and simulates a click event on it based on its padding box. The current tab doesn't need to be focused.

Link copied to clipboard
abstract suspend fun close(keepBrowserContext: Boolean = false)

Closes this session and its target. If the target is a page, the tab gets closed.

Link copied to clipboard
abstract suspend fun closeWebSocket()

Closes the underlying web socket connection, effectively closing every session based on the same web socket connection.

Link copied to clipboard
abstract suspend fun detach()

Detaches this session from its target, effectively closing this session and all its child sessions, but without closing the corresponding target (this leaves the tab open in the case of a page session).

Link copied to clipboard
suspend fun PageSession.goto(url: String, configure: GotoConfigBuilder.() -> Unit = {})

Navigates the current page to the provided url, and suspends until the configured completion events are fired. By default, this function suspends until the GotoCompletionEvent.Load event is fired.

Link copied to clipboard
abstract fun unsafe(): AllDomainsTarget

Gives access to all domains of the protocol, regardless of the type of this session.