glendam/protocol/target
This module is generated from the Chrome DevTools Protocol schema.
Do not edit this file manually. Generator: dev/codegen/generate_bindings.gleam Regenerate with:
gleam run -m codegen/generate_bindings
Protocol version: 1.3
Target Domain
Supports additional targets discovery and allows to attach to them.
📖 View this domain on the DevTools Protocol API Docs
Types
This type is not part of the protocol spec, it has been generated dynamically
to represent the response to the command attach_to_target
pub type AttachToTargetResponse {
AttachToTargetResponse(session_id: SessionID)
}
Constructors
-
AttachToTargetResponse(session_id: SessionID)Represents the AttachToTargetResponse protocol value.
Arguments
- session_id
-
Id assigned to the session.
This type is not part of the protocol spec, it has been generated dynamically
to represent the response to the command create_browser_context
pub type CreateBrowserContextResponse {
CreateBrowserContextResponse(browser_context_id: String)
}
Constructors
-
CreateBrowserContextResponse(browser_context_id: String)Represents the CreateBrowserContextResponse protocol value.
Arguments
- browser_context_id
-
The id of the context created.
This type is not part of the protocol spec, it has been generated dynamically
to represent the response to the command create_target
pub type CreateTargetResponse {
CreateTargetResponse(target_id: TargetID)
}
Constructors
-
CreateTargetResponse(target_id: TargetID)Represents the CreateTargetResponse protocol value.
Arguments
- target_id
-
The id of the page opened.
This type is not part of the protocol spec, it has been generated dynamically
to represent the response to the command get_browser_contexts
pub type GetBrowserContextsResponse {
GetBrowserContextsResponse(browser_context_ids: List(String))
}
Constructors
-
GetBrowserContextsResponse(browser_context_ids: List(String))Represents the GetBrowserContextsResponse protocol value.
Arguments
- browser_context_ids
-
An array of browser context ids.
This type is not part of the protocol spec, it has been generated dynamically
to represent the response to the command get_targets
pub type GetTargetsResponse {
GetTargetsResponse(target_infos: List(TargetInfo))
}
Constructors
-
GetTargetsResponse(target_infos: List(TargetInfo))Represents the GetTargetsResponse protocol value.
Arguments
- target_infos
-
The list of targets.
Unique identifier of attached debugging session.
pub type SessionID {
SessionID(String)
}
Constructors
-
SessionID(String)Represents the SessionID protocol value.
Represents the Chrome DevTools Protocol TargetID value.
pub type TargetID {
TargetID(String)
}
Constructors
-
TargetID(String)Represents the TargetID protocol value.
Represents the Chrome DevTools Protocol TargetInfo value.
pub type TargetInfo {
TargetInfo(
target_id: TargetID,
type_: String,
title: String,
url: String,
attached: protocol_support.BooleanSetting,
opener_id: option.Option(TargetID),
)
}
Constructors
-
TargetInfo( target_id: TargetID, type_: String, title: String, url: String, attached: protocol_support.BooleanSetting, opener_id: option.Option(TargetID), )Represents the TargetInfo protocol value.
Arguments
- type_
-
List of types: https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/devtools_agent_host_impl.cc?ss=chromium&q=f:devtools%20-f:out%20%22::kTypeTab%5B%5D%22
- attached
-
Whether the target has an attached client.
- opener_id
-
Opener target Id
Values
pub fn activate_target(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
target_id target_id: TargetID,
) -> Result(dynamic.Dynamic, chrome.RequestError)
Activates (focuses) the target.
Parameters:
target_id
Returns:
pub fn attach_to_target(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
target_id target_id: TargetID,
flatten flatten: option.Option(protocol_support.BooleanSetting),
) -> Result(AttachToTargetResponse, chrome.RequestError)
Attaches to the target with given id.
Parameters:
target_idflatten: Enables “flat” access to the session via specifying sessionId attribute in the commands. We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See crbug.com/991325.
Returns:
session_id: Id assigned to the session.
pub fn close_target(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
target_id target_id: TargetID,
) -> Result(dynamic.Dynamic, chrome.RequestError)
Closes the target. If the target is a page that gets closed too.
Parameters:
target_id
Returns:
pub fn create_browser_context(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
) -> Result(CreateBrowserContextResponse, chrome.RequestError)
Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one.
Parameters:
Returns:
browser_context_id: The id of the context created.
pub fn create_target(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
url url: String,
width width: option.Option(Int),
height height: option.Option(Int),
new_window new_window: option.Option(
protocol_support.BooleanSetting,
),
background background: option.Option(
protocol_support.BooleanSetting,
),
) -> Result(CreateTargetResponse, chrome.RequestError)
Creates a new page.
Parameters:
url: The initial URL the page will be navigated to. An empty string indicates about:blank.width: Frame width in DIP (headless chrome only).height: Frame height in DIP (headless chrome only).new_window: Whether to create a new Window or Tab (chrome-only, false by default).background: Whether to create the target in background or foreground (chrome-only, false by default).
Returns:
target_id: The id of the page opened.
pub fn detach_from_target(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
session_id session_id: option.Option(SessionID),
) -> Result(dynamic.Dynamic, chrome.RequestError)
Detaches session with given id.
Parameters:
session_id: Session to detach.
Returns:
pub fn dispose_browser_context(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
browser_context_id browser_context_id: String,
) -> Result(dynamic.Dynamic, chrome.RequestError)
Deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks.
Parameters:
browser_context_id
Returns:
pub fn get_browser_contexts(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
) -> Result(GetBrowserContextsResponse, chrome.RequestError)
Returns all browser contexts created with Target.createBrowserContext method.
browser_context_ids: An array of browser context ids.
pub fn get_targets(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
) -> Result(GetTargetsResponse, chrome.RequestError)
Retrieves a list of available targets.
Parameters:
Returns:
target_infos: The list of targets.
pub fn set_auto_attach(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
auto_attach auto_attach: protocol_support.BooleanSetting,
wait_for_debugger_on_start wait_for_debugger_on_start: protocol_support.BooleanSetting,
) -> Result(dynamic.Dynamic, chrome.RequestError)
Controls whether to automatically attach to new targets which are considered to be related to
this one. When turned on, attaches to all existing related targets as well. When turned off,
automatically detaches from all currently attached targets.
This also clears all targets added by autoAttachRelated from the list of targets to watch
for creation of related targets.
Parameters:
auto_attach: Whether to auto-attach to related targets.wait_for_debugger_on_start: Whether to pause new targets when attaching to them. UseRuntime.runIfWaitingForDebuggerto run paused targets.
Returns:
pub fn set_discover_targets(
callback callback__: fn(String, option.Option(json.Json)) -> Result(
dynamic.Dynamic,
chrome.RequestError,
),
discover discover: protocol_support.BooleanSetting,
) -> Result(dynamic.Dynamic, chrome.RequestError)
Controls whether to discover available targets and notify via
targetCreated/targetInfoChanged/targetDestroyed events.
Parameters:
discover: Whether to discover available targets.
Returns: