Skip to content

Invoke Browser

bedrockagentcore_invoke_browser R Documentation

Invokes an operating system-level action on a browser session in Amazon Bedrock AgentCore

Description

Invokes an operating system-level action on a browser session in Amazon Bedrock AgentCore. This operation provides direct OS-level control over browser sessions, enabling mouse actions, keyboard input, and screenshots that the WebSocket-based Chrome DevTools Protocol (CDP) cannot handle — such as interacting with print dialogs, context menus, and JavaScript alerts.

You send a request with exactly one action in the BrowserAction union, and receive a corresponding result in the BrowserActionResult union.

The following operations are related to invoke_browser:

  • start_browser_session

  • get_browser_session

  • stop_browser_session

Usage

bedrockagentcore_invoke_browser(browserIdentifier, sessionId, action)

Arguments

browserIdentifier

[required] The unique identifier of the browser associated with the session. This must match the identifier used when creating the session with start_browser_session.

sessionId

[required] The unique identifier of the browser session on which to perform the action. This must be an active session created with start_browser_session.

action

[required] The browser action to perform. Exactly one member of the BrowserAction union must be set per request.

Value

A list with the following syntax:

list(
  result = list(
    mouseClick = list(
      status = "SUCCESS"|"FAILED",
      error = "string"
    ),
    mouseMove = list(
      status = "SUCCESS"|"FAILED",
      error = "string"
    ),
    mouseDrag = list(
      status = "SUCCESS"|"FAILED",
      error = "string"
    ),
    mouseScroll = list(
      status = "SUCCESS"|"FAILED",
      error = "string"
    ),
    keyType = list(
      status = "SUCCESS"|"FAILED",
      error = "string"
    ),
    keyPress = list(
      status = "SUCCESS"|"FAILED",
      error = "string"
    ),
    keyShortcut = list(
      status = "SUCCESS"|"FAILED",
      error = "string"
    ),
    screenshot = list(
      status = "SUCCESS"|"FAILED",
      error = "string",
      data = raw
    )
  ),
  sessionId = "string"
)

Request syntax

svc$invoke_browser(
  browserIdentifier = "string",
  sessionId = "string",
  action = list(
    mouseClick = list(
      x = 123,
      y = 123,
      button = "LEFT"|"RIGHT"|"MIDDLE",
      clickCount = 123
    ),
    mouseMove = list(
      x = 123,
      y = 123
    ),
    mouseDrag = list(
      endX = 123,
      endY = 123,
      startX = 123,
      startY = 123,
      button = "LEFT"|"RIGHT"|"MIDDLE"
    ),
    mouseScroll = list(
      x = 123,
      y = 123,
      deltaX = 123,
      deltaY = 123
    ),
    keyType = list(
      text = "string"
    ),
    keyPress = list(
      key = "string",
      presses = 123
    ),
    keyShortcut = list(
      keys = list(
        "string"
      )
    ),
    screenshot = list(
      format = "PNG"
    )
  )
)