createTarget

suspend fun createTarget(args: Target.CreateTargetParameter, mode: CommandMode = CommandMode.DEFAULT): Target.CreateTargetReturn

Creates a new page.


suspend fun createTarget(url: String, left: Int? = null, top: Int? = null, width: Int? = null, height: Int? = null, windowState: Target.WindowState? = null, browserContextId: String? = null, enableBeginFrameControl: Boolean? = null, newWindow: Boolean? = null, background: Boolean? = null, forTab: Boolean? = null, hidden: Boolean? = null): Target.CreateTargetReturn

Creates a new page.

Parameters

url

The initial URL the page will be navigated to. An empty string indicates about:blank.

left

Frame left origin in DIP (requires newWindow to be true or headless shell).

top

Frame top origin in DIP (requires newWindow to be true or headless shell).

width

Frame width in DIP (requires newWindow to be true or headless shell).

height

Frame height in DIP (requires newWindow to be true or headless shell).

windowState

Frame window state (requires newWindow to be true or headless shell). Default is normal.

browserContextId

The browser context to create the page in.

enableBeginFrameControl

Whether BeginFrames for this target will be controlled via DevTools (headless shell only, not supported on MacOS yet, false by default).

newWindow

Whether to create a new Window or Tab (false by default, not supported by headless shell).

background

Whether to create the target in background or foreground (false by default, not supported by headless shell).

forTab

Whether to create the target of type "tab".

hidden

Whether to create a hidden target. The hidden target is observable via protocol, but not present in the tab UI strip. Cannot be created with forTab: true, newWindow: true or background: false. The life-time of the tab is limited to the life-time of the session.