README

mizchi/webdriver/bidi does not have a README file

#
AccessibilityLocator

pub struct AccessibilityLocator {
role : String
name : String?
exact : Bool?
} derive(Show)

Accessibility locator value

#
ActionOrigin

pub enum ActionOrigin {
Viewport
Pointer
ElementHandle(String)
ElementSharedId(String)
} derive(Show)

Action origin for pointer actions

#
ActionOrigin::element_handle

fn ActionOrigin::element_handle(handle : String) -> ActionOrigin

#
ActionOrigin::element_shared_id

fn ActionOrigin::element_shared_id(shared_id : String) -> ActionOrigin

#
ActionOrigin::pointer

fn ActionOrigin::pointer() -> ActionOrigin

#
ActionOrigin::to_json

fn ActionOrigin::to_json(self : ActionOrigin) -> Json

#
ActionOrigin::viewport

fn ActionOrigin::viewport() -> ActionOrigin

#
ActionSequence

pub struct ActionSequence {
id : String
source_type : InputSourceType
actions : Array[InputAction]
parameters : PointerParameters?
} derive(Show)

Action sequence for input.performActions

#
ActionSequence::key

fn ActionSequence::key(id : String, actions : Array[InputAction]) -> ActionSequence

#
ActionSequence::none

fn ActionSequence::none(id : String, actions : Array[InputAction]) -> ActionSequence

#
ActionSequence::pointer

fn ActionSequence::pointer(id : String, pointer_type : PointerType, actions : Array[InputAction]) -> ActionSequence

#
ActionSequence::to_json

fn ActionSequence::to_json(self : ActionSequence) -> Json

#
Backend

pub struct Backend {
navigate : (String, String, String) -> Result[NavigationResult, BackendError]
evaluate : (String, String, Bool) -> Result[Json, BackendError]
locate_nodes : (String, Json, Int?) -> Result[Array[NodeReference], BackendError]
perform_actions : (String?, Array[Json]) -> Result[Unit, BackendError]
release_actions : (String?) -> Result[Unit, BackendError]
capture_screenshot : (String, String?) -> Result[String, BackendError]
capabilities : () -> BackendCapabilities
}

Backend contract for protocol behavior

#
Backend::new

fn Backend::new(navigate : (String, String, String) -> Result[NavigationResult, BackendError], evaluate : (String, String, Bool) -> Result[Json, BackendError], locate_nodes : (String, Json, Int?) -> Result[Array[NodeReference], BackendError], perform_actions : (String?, Array[Json]) -> Result[Unit, BackendError], release_actions : (String?) -> Result[Unit, BackendError], capture_screenshot : (String, String?) -> Result[String, BackendError], capabilities : () -> BackendCapabilities) -> Backend

Create backend contract object

#
BackendCapabilities

pub struct BackendCapabilities {
navigation : Bool
evaluate : Bool
element_lookup : Bool
input_actions : Bool
screenshot : Bool
} derive(Eq, Show)

Backend capability flags

#
BackendError

pub enum BackendError {
InvalidArgument(String)
NotFound(String)
} derive(Eq, Show)

Backend contract error

#
BidiClient

pub struct BidiClient {
transport : Transport
next_id : Int
connected : Bool
has_subscription_filter : Bool
pending : Map[Int, BidiResponse]
event_handlers : Array[(BidiEvent) -> Unit]
global_subscriptions : Map[String, Bool]
context_subscriptions : Map[String, Map[String, Bool]]
}

BiDi client state

#
BidiClient::browser_close

async fn BidiClient::browser_close(self : BidiClient) -> Result[Unit, ClientError]

browser.close

#
BidiClient::browser_create_user_context

async fn BidiClient::browser_create_user_context(self : BidiClient) -> Result[String, ClientError]

browser.createUserContext

#
BidiClient::browser_get_user_contexts

async fn BidiClient::browser_get_user_contexts(self : BidiClient) -> Result[Array[String], ClientError]

browser.getUserContexts

#
BidiClient::browser_remove_user_context

async fn BidiClient::browser_remove_user_context(self : BidiClient, user_context : String) -> Result[Unit, ClientError]

browser.removeUserContext

#
BidiClient::browsing_context_capture_screenshot

async fn BidiClient::browsing_context_capture_screenshot(self : BidiClient, context_id : String, origin? : String, format? : String, quality? : Int, clip? : Json) -> Result[String, ClientError]

browsingContext.captureScreenshot

#
BidiClient::browsing_context_close

async fn BidiClient::browsing_context_close(self : BidiClient, context_id : String) -> Result[Unit, ClientError]

browsingContext.close

#
BidiClient::browsing_context_create

async fn BidiClient::browsing_context_create(self : BidiClient, context_type : String, user_context? : String) -> Result[String, ClientError]

browsingContext.create

#
BidiClient::browsing_context_get_tree

async fn BidiClient::browsing_context_get_tree(self : BidiClient, root? : String, max_depth? : Int) -> Result[Json, ClientError]

browsingContext.getTree

#
BidiClient::browsing_context_locate_nodes

async fn BidiClient::browsing_context_locate_nodes(self : BidiClient, context_id : String, locator : Json, max_node_count? : Int, serialization_options? : SerializationOptions) -> Result[Json, ClientError]

browsingContext.locateNodes

#
BidiClient::browsing_context_locate_nodes_typed

async fn BidiClient::browsing_context_locate_nodes_typed(self : BidiClient, context_id : String, locator : Locator, max_node_count? : Int, serialization_options? : SerializationOptions) -> Result[Json, ClientError]

browsingContext.locateNodes (typed)

#
BidiClient::browsing_context_locate_nodes_typed_refs

async fn BidiClient::browsing_context_locate_nodes_typed_refs(self : BidiClient, context_id : String, locator : Locator, max_node_count? : Int, serialization_options? : SerializationOptions) -> Result[Array[NodeReference], ClientError]

browsingContext.locateNodes (typed refs)

#
BidiClient::browsing_context_navigate

async fn BidiClient::browsing_context_navigate(self : BidiClient, context_id : String, url : String, wait? : String) -> Result[NavigationResult, ClientError]

browsingContext.navigate

#
BidiClient::browsing_context_reload

async fn BidiClient::browsing_context_reload(self : BidiClient, context_id : String) -> Result[Unit, ClientError]

browsingContext.reload

#
BidiClient::close

fn BidiClient::close(self : BidiClient) -> Result[Unit, ClientError]

Close transport

#
BidiClient::connect

async fn BidiClient::connect(self : BidiClient) -> Result[Unit, ClientError]

Connect transport

#
BidiClient::dispatch

async fn BidiClient::dispatch(self : BidiClient, domain : String, command : String, params? : Json?) -> Result[Json, ClientError]

Dispatch request through the domain router

#
BidiClient::input_perform_actions

async fn BidiClient::input_perform_actions(self : BidiClient, actions : Array[Json], context_id? : String) -> Result[Unit, ClientError]

input.performActions

#
BidiClient::input_perform_actions_typed

async fn BidiClient::input_perform_actions_typed(self : BidiClient, actions : Array[ActionSequence], context_id? : String) -> Result[Unit, ClientError]

input.performActions (typed)

#
BidiClient::input_release_actions

async fn BidiClient::input_release_actions(self : BidiClient, context_id? : String) -> Result[Unit, ClientError]

input.releaseActions

#
BidiClient::network_add_data_collector

async fn BidiClient::network_add_data_collector(self : BidiClient) -> Result[Unit, ClientError]

network.addDataCollector

#
BidiClient::network_add_data_collector_typed

async fn BidiClient::network_add_data_collector_typed(self : BidiClient, collector : NetworkDataCollector) -> Result[Unit, ClientError]

network.addDataCollector (typed)

#
BidiClient::network_set_cache_behavior

async fn BidiClient::network_set_cache_behavior(self : BidiClient, cache_behavior : String, contexts? : Array[String]) -> Result[Unit, ClientError]

network.setCacheBehavior

#
BidiClient::network_set_cache_behavior_typed

async fn BidiClient::network_set_cache_behavior_typed(self : BidiClient, cache_behavior : CacheBehavior, contexts? : Array[String]) -> Result[Unit, ClientError]

network.setCacheBehavior (typed)

#
BidiClient::new

fn BidiClient::new(transport : Transport) -> BidiClient

Create a new client

#
BidiClient::on_browser_event

fn BidiClient::on_browser_event(self : BidiClient, handler : (BidiEvent) -> Unit) -> Unit

Register handler for browser.* events

#
BidiClient::on_browsing_context_event

fn BidiClient::on_browsing_context_event(self : BidiClient, handler : (BidiEvent) -> Unit) -> Unit

Register handler for browsingContext.* events

#
BidiClient::on_event

fn BidiClient::on_event(self : BidiClient, handler : (BidiEvent) -> Unit) -> Unit

Register event handler

#
BidiClient::on_event_method

fn BidiClient::on_event_method(self : BidiClient, event_method : String, handler : (BidiEvent) -> Unit) -> Unit

Register handler for a specific event method

#
BidiClient::on_input_event

fn BidiClient::on_input_event(self : BidiClient, handler : (BidiEvent) -> Unit) -> Unit

Register handler for input.* events

#
BidiClient::on_log_entry_added

fn BidiClient::on_log_entry_added(self : BidiClient, level? : String, handler : (BidiEvent) -> Unit) -> Unit

Register handler for log.entryAdded (optional level filter)

#
BidiClient::on_log_event

fn BidiClient::on_log_event(self : BidiClient, handler : (BidiEvent) -> Unit) -> Unit

Register handler for log.* events

#
BidiClient::on_network_event

fn BidiClient::on_network_event(self : BidiClient, handler : (BidiEvent) -> Unit) -> Unit

Register handler for network.* events

#
BidiClient::on_script_event

fn BidiClient::on_script_event(self : BidiClient, handler : (BidiEvent) -> Unit) -> Unit

Register handler for script.* events

#
BidiClient::on_session_event

fn BidiClient::on_session_event(self : BidiClient, handler : (BidiEvent) -> Unit) -> Unit

Register handler for session.* events

#
BidiClient::script_add_preload_script

async fn BidiClient::script_add_preload_script(self : BidiClient, function_declaration : String, arguments? : Array[RemoteValue], contexts? : Array[String], user_contexts? : Array[String], sandbox? : String) -> Result[String, ClientError]

script.addPreloadScript

#
BidiClient::script_call_function

async fn BidiClient::script_call_function(self : BidiClient, function_declaration : String, context_id : String, arguments? : Array[Json], await_promise? : Bool, result_ownership? : ResultOwnership, serialization_options? : SerializationOptions, user_activation? : Bool, this_value? : Json) -> Result[Json, ClientError]

script.callFunction

#
BidiClient::script_call_function_typed

async fn BidiClient::script_call_function_typed(self : BidiClient, function_declaration : String, context_id : String, arguments? : Array[RemoteValue], await_promise? : Bool, result_ownership? : ResultOwnership, serialization_options? : SerializationOptions, user_activation? : Bool, this_value? : RemoteValue) -> Result[Json, ClientError]

script.callFunction (typed arguments)

#
BidiClient::script_disown

async fn BidiClient::script_disown(self : BidiClient, handles : Array[String], context_id? : String, sandbox? : String) -> Result[Unit, ClientError]

script.disown

#
BidiClient::script_evaluate

async fn BidiClient::script_evaluate(self : BidiClient, expression : String, context_id : String, await_promise? : Bool, result_ownership? : ResultOwnership, serialization_options? : SerializationOptions, user_activation? : Bool) -> Result[Json, ClientError]

script.evaluate

#
BidiClient::script_remove_preload_script

async fn BidiClient::script_remove_preload_script(self : BidiClient, script_id : String) -> Result[Unit, ClientError]

script.removePreloadScript

#
BidiClient::send

async fn BidiClient::send(self : BidiClient, method_name : String, params? : Json?) -> Result[Json, ClientError]

Send raw request and await response

#
BidiClient::session_end

async fn BidiClient::session_end(self : BidiClient) -> Result[Unit, ClientError]

Session: end

#
BidiClient::session_new

async fn BidiClient::session_new(self : BidiClient, capabilities? : Json?) -> Result[SessionInfo, ClientError]

Session: new

#
BidiClient::session_status

async fn BidiClient::session_status(self : BidiClient) -> Result[SessionStatus, ClientError]

Session: status

#
BidiClient::session_subscribe

async fn BidiClient::session_subscribe(self : BidiClient, events : Array[String], contexts? : Array[String]) -> Result[Unit, ClientError]

Session: subscribe

#
BidiClient::session_unsubscribe

async fn BidiClient::session_unsubscribe(self : BidiClient, events : Array[String], contexts? : Array[String]) -> Result[Unit, ClientError]

Session: unsubscribe

#
BidiError

pub struct BidiError {
error : String
message : String
stacktrace : String
} derive(Show)

BiDi error payload

#
BidiEvent

pub struct BidiEvent {
event_method : String
params : Json
} derive(Show)

BiDi event message

#
BidiIncoming

pub enum BidiIncoming {
Response(BidiResponse)
Event(BidiEvent)
} derive(Show)

Incoming BiDi message

#
BidiRequest

pub struct BidiRequest {
id : Int
method_name : String
params : Json?
} derive(Show)

BiDi request message

#
BidiRequest::to_json

fn BidiRequest::to_json(self : BidiRequest) -> String

Serialize request to JSON string

#
BidiResponse

pub struct BidiResponse {
id : Int
result : Json?
error : BidiError?
} derive(Show)

BiDi response message

#
CacheBehavior

pub struct CacheBehavior {
value : String
} derive(Show)

Network cache behavior wrapper

#
CacheBehavior::bypass

#
CacheBehavior::default

fn CacheBehavior::default() -> CacheBehavior

#
CacheBehavior::new

fn CacheBehavior::new(value : String) -> CacheBehavior

#
CacheBehavior::to_string

fn CacheBehavior::to_string(self : CacheBehavior) -> String

#
ChromePipeState

pub struct ChromePipeState {
headless : Bool
proc_id :
Ref
[Int?]
closed :
Ref
[Bool]
}

Chrome BiDi pipe transport state

#
ClientError

pub enum ClientError {
Transport(TransportError)
ParseError(String)
InvalidArgument(String)
ResponseError(BidiError)
} derive(Show)

Client error

#
CustomTransport

pub struct CustomTransport {
connect : () -> Result[Unit, TransportError]
send : (String) -> Result[Unit, TransportError]
recv : () -> Result[String, TransportError]
close : () -> Result[Unit, TransportError]
}

Custom transport hooks (sync)

#
CustomTransport::new

fn CustomTransport::new(connect : () -> Result[Unit, TransportError], send : (String) -> Result[Unit, TransportError], recv : () -> Result[String, TransportError], close : () -> Result[Unit, TransportError]) -> CustomTransport

Create custom transport

#
InMemoryBackend

pub struct InMemoryBackend {
state :
Ref
[InMemoryBackendState]
}

Minimal in-memory backend

#
InMemoryBackend::action_log_length

fn InMemoryBackend::action_log_length(self : InMemoryBackend) -> Int

Snapshot helper for in-memory action history size

#
InMemoryBackend::get_context_url

fn InMemoryBackend::get_context_url(self : InMemoryBackend, context_id : String) -> String?

Snapshot helper for in-memory contexts

#
InMemoryBackend::new

fn InMemoryBackend::new(initial_contexts? : Array[String]) -> InMemoryBackend

Create in-memory backend

#
InMemoryBackend::to_backend

fn InMemoryBackend::to_backend(self : InMemoryBackend) -> Backend

Export in-memory backend as contract

#
InMemoryBackendState

pub struct InMemoryBackendState {
next_navigation_id : Int
contexts : Map[String, String]
action_log : Array[String]
}

In-memory backend state

#
InnerTextLocator

pub struct InnerTextLocator {
text : String
match_type : InnerTextMatchType
ignore_case : Bool
} derive(Show)

InnerText locator value

#
InnerTextMatchType

pub enum InnerTextMatchType {
Full
Partial
} derive(Eq, Show)

Match type for innerText locator

#
InnerTextMatchType::full

#
InnerTextMatchType::partial

#
InnerTextMatchType::to_string

fn InnerTextMatchType::to_string(self : InnerTextMatchType) -> String

#
InputAction

pub enum InputAction {
Pause(Int?)
PointerMove(Double, Double, ActionOrigin, Int?)
PointerDown(Int)
PointerUp(Int)
PointerCancel
KeyDown(String)
KeyUp(String)
} derive(Show)

Input action item

#
InputAction::key_down

fn InputAction::key_down(value : String) -> InputAction

#
InputAction::key_up

fn InputAction::key_up(value : String) -> InputAction

#
InputAction::pause

fn InputAction::pause(duration? : Int) -> InputAction

#
InputAction::pointer_cancel

fn InputAction::pointer_cancel() -> InputAction

#
InputAction::pointer_down

fn InputAction::pointer_down(button : Int) -> InputAction

#
InputAction::pointer_move

fn InputAction::pointer_move(x : Double, y : Double, origin? : ActionOrigin, duration? : Int?) -> InputAction

#
InputAction::pointer_up

fn InputAction::pointer_up(button : Int) -> InputAction

#
InputAction::to_json

fn InputAction::to_json(self : InputAction) -> Json

#
InputSourceType

pub enum InputSourceType {
Pointer
Key
NoneSource
} derive(Eq, Show)

Input source type

#
InputSourceType::to_string

fn InputSourceType::to_string(self : InputSourceType) -> String

#
JsWebSocketState

pub struct JsWebSocketState {
url : String
socket_id :
Ref
[Int?]
closed :
Ref
[Bool]
}

JS WebSocket state

#
Locator

pub enum Locator {
Css(String)
Xpath(String)
InnerText(InnerTextLocator)
Accessibility(AccessibilityLocator)
Custom(String, Json)
} derive(Show)

Locator for browsingContext.locateNodes

#
Locator::accessibility

fn Locator::accessibility(role : String, name? : String, exact? : Bool) -> Locator

#
Locator::css

fn Locator::css(selector : String) -> Locator

#
Locator::custom

fn Locator::custom(type_name : String, value : Json) -> Locator

#
Locator::inner_text

fn Locator::inner_text(text : String, match_type? : InnerTextMatchType, ignore_case? : Bool) -> Locator

#
Locator::to_json

fn Locator::to_json(self : Locator) -> Json

#
Locator::xpath

fn Locator::xpath(expr : String) -> Locator

pub struct NavigationResult {
navigation : String
url : String
} derive(Show)

browsingContext.navigate result

#
NetworkDataCollector

pub struct NetworkDataCollector {
data_types : Array[String]
contexts : Array[String]?
} derive(Show)

network.addDataCollector params

#
NetworkDataCollector::new

fn NetworkDataCollector::new(data_types : Array[String], contexts? : Array[String]) -> NetworkDataCollector

#
NetworkDataCollector::to_json

#
NodeReference

pub struct NodeReference {
handle : String?
shared_id : String?
} derive(Show)

browsingContext.locateNodes node reference

#
PointerParameters

pub struct PointerParameters {
pointer_type : PointerType
} derive(Show)

Pointer parameters

#
PointerParameters::to_json

#
PointerType

pub enum PointerType {
Mouse
Pen
Touch
} derive(Eq, Show)

Pointer device type

#
PointerType::mouse

fn PointerType::mouse() -> PointerType

#
PointerType::pen

#
PointerType::to_string

fn PointerType::to_string(self : PointerType) -> String

#
PointerType::touch

fn PointerType::touch() -> PointerType

#
RemoteValue

pub struct RemoteValue {
json : Json
} derive(Show)

Remote value for script arguments

#
RemoteValue::boolean

fn RemoteValue::boolean(value : Bool) -> RemoteValue

#
RemoteValue::handle

fn RemoteValue::handle(handle : String) -> RemoteValue

#
RemoteValue::null

fn RemoteValue::null() -> RemoteValue

#
RemoteValue::number

fn RemoteValue::number(value : Double) -> RemoteValue

#
RemoteValue::shared_id

fn RemoteValue::shared_id(shared_id : String) -> RemoteValue

#
RemoteValue::string

fn RemoteValue::string(value : String) -> RemoteValue

#
RemoteValue::to_json

fn RemoteValue::to_json(self : RemoteValue) -> Json

#
RemoteValue::undefined

fn RemoteValue::undefined() -> RemoteValue

#
ResultOwnership

pub enum ResultOwnership {
NoneOwnership
Root
} derive(Eq, Show)

Result ownership for script.evaluate / callFunction

#
ResultOwnership::none

#
ResultOwnership::root

#
ResultOwnership::to_string

fn ResultOwnership::to_string(self : ResultOwnership) -> String

#
SerializationOptions

pub struct SerializationOptions {
max_depth : Int?
max_object_depth : Int?
include_shadow_tree : String?
} derive(Show)

Serialization options for script results

#
SerializationOptions::new

fn SerializationOptions::new(max_depth? : Int, max_object_depth? : Int, include_shadow_tree? : String) -> SerializationOptions

#
SerializationOptions::to_json

#
SessionInfo

pub struct SessionInfo {
session_id : String
capabilities : Json?
} derive(Show)

session.new result

#
SessionStatus

pub struct SessionStatus {
ready : Bool
message : String?
} derive(Show)

session.status result

#
Transport

pub enum Transport {
JsWebSocket(JsWebSocketState)
ChromePipe(ChromePipeState)
Custom(CustomTransport)
Unsupported(TransportError)
}

#
Transport::chrome_bidi_pipe

fn Transport::chrome_bidi_pipe(headless? : Bool) -> Transport

Launch Chrome with BiDi pipe and return a connected transport.

#
Transport::close

fn Transport::close(self : Transport) -> Result[Unit, TransportError]

Close transport

#
Transport::connect

async fn Transport::connect(self : Transport) -> Result[Unit, TransportError]

Connect transport

#
Transport::custom

fn Transport::custom(custom : CustomTransport) -> Transport

Create custom transport wrapper

#
Transport::recv

async fn Transport::recv(self : Transport) -> Result[String, TransportError]

Receive next message

#
Transport::send

async fn Transport::send(self : Transport, message : String) -> Result[Unit, TransportError]

Send message

#
Transport::unsupported

fn Transport::unsupported(message : String) -> Transport

Create unsupported transport

#
Transport::websocket

fn Transport::websocket(url : String) -> Transport

Create JS WebSocket transport

#
TransportError

pub enum TransportError {
NotSupported(String)
NetworkError(String)
Closed
} derive(Show)

Transport error

#
error_response_to_json

fn error_response_to_json(id : Int, code : String, message : String) -> String

Serialize a WebDriver BiDi error response envelope.

#
error_response_to_json_with_stacktrace

fn error_response_to_json_with_stacktrace(id : Int, code : String, message : String, stacktrace : String) -> String

Serialize a WebDriver BiDi error response envelope with stacktrace.

#
event_to_json

fn event_to_json(event_method : String, params : Json) -> String

Serialize a WebDriver BiDi event envelope.

#
parse_incoming

fn parse_incoming(json_str : String) -> Result[BidiIncoming, String]

Parse incoming message (response/event)

#
parse_request

fn parse_request(json_str : String) -> Result[BidiRequest, String]

Parse incoming command request JSON for BiDi server implementations.

#
success_response_to_json

fn success_response_to_json(id : Int, result : Json?) -> String

Serialize a WebDriver BiDi success response envelope.