Note:

You are viewing the documentation for an older major version of the AWS CLI (version 1). To view this page for the AWS CLI version 2, click here.

We announced the upcoming end-of-support for the AWS CLI v1. For dates, additional details, and information on how to migrate, please refer to the linked announcement. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . bedrock-agentcore ]

invoke-browser

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 InvokeBrowser :

See also: AWS API Documentation

Synopsis

  invoke-browser
--browser-identifier <value>
--session-id <value>
--action <value>
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--v2-debug]

Options

--browser-identifier (string)

The unique identifier of the browser associated with the session. This must match the identifier used when creating the session with StartBrowserSession .

--session-id (string)

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

--action (tagged union structure)

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

Note

This is a Tagged Union structure. Only one of the following top level keys can be set: mouseClick, mouseMove, mouseDrag, mouseScroll, keyType, keyPress, keyShortcut, screenshot.

mouseClick -> (structure)

Click at the specified coordinates.

x -> (integer)

The X coordinate on screen where the click occurs.

y -> (integer)

The Y coordinate on screen where the click occurs.

button -> (string)

The mouse button to use. Defaults to LEFT .

clickCount -> (integer)

The number of clicks to perform. Valid range: 1–10. Defaults to 1.

mouseMove -> (structure)

Move the cursor to the specified coordinates.

x -> (integer)

The target X coordinate on screen.

y -> (integer)

The target Y coordinate on screen.

mouseDrag -> (structure)

Drag from a start position to an end position.

endX -> (integer)

The ending X coordinate for the drag.

endY -> (integer)

The ending Y coordinate for the drag.

startX -> (integer)

The starting X coordinate for the drag.

startY -> (integer)

The starting Y coordinate for the drag.

button -> (string)

The mouse button to use for the drag. Defaults to LEFT .

mouseScroll -> (structure)

Scroll at the specified position.

x -> (integer)

The X coordinate on screen where the scroll occurs.

y -> (integer)

The Y coordinate on screen where the scroll occurs.

deltaX -> (integer)

The horizontal scroll delta. Valid range: -1000 to 1000.

deltaY -> (integer)

The vertical scroll delta. Valid range: -1000 to 1000. Negative values scroll down.

keyType -> (structure)

Type a string of text.

text -> (string)

The text string to type. Maximum length: 10,000 characters.

keyPress -> (structure)

Press a key one or more times.

key -> (string)

The key name to press (for example, enter , tab , escape ).

presses -> (integer)

The number of times to press the key. Valid range: 1–100. Defaults to 1.

keyShortcut -> (structure)

Press a key combination.

keys -> (list)

The key combination to press (for example, ["ctrl", "s"] ). Maximum 5 keys.

(string)

screenshot -> (structure)

Capture a full-screen screenshot.

format -> (string)

The image format for the screenshot. Defaults to PNG .

Shorthand Syntax:

mouseClick={x=integer,y=integer,button=string,clickCount=integer},mouseMove={x=integer,y=integer},mouseDrag={endX=integer,endY=integer,startX=integer,startY=integer,button=string},mouseScroll={x=integer,y=integer,deltaX=integer,deltaY=integer},keyType={text=string},keyPress={key=string,presses=integer},keyShortcut={keys=[string,string]},screenshot={format=string}

JSON Syntax:

{
  "mouseClick": {
    "x": integer,
    "y": integer,
    "button": "LEFT"|"RIGHT"|"MIDDLE",
    "clickCount": integer
  },
  "mouseMove": {
    "x": integer,
    "y": integer
  },
  "mouseDrag": {
    "endX": integer,
    "endY": integer,
    "startX": integer,
    "startY": integer,
    "button": "LEFT"|"RIGHT"|"MIDDLE"
  },
  "mouseScroll": {
    "x": integer,
    "y": integer,
    "deltaX": integer,
    "deltaY": integer
  },
  "keyType": {
    "text": "string"
  },
  "keyPress": {
    "key": "string",
    "presses": integer
  },
  "keyShortcut": {
    "keys": ["string", ...]
  },
  "screenshot": {
    "format": "PNG"
  }
}

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

Global Options

--debug (boolean)

Turn on debug logging.

--endpoint-url (string)

Override command’s default URL with the given URL.

--no-verify-ssl (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

--no-paginate (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

--output (string)

The formatting style for command output.

  • json
  • text
  • table

--query (string)

A JMESPath query to use in filtering the response data.

--profile (string)

Use a specific profile from your credential file.

--region (string)

The region to use. Overrides config/env settings.

--version (string)

Display the version of this tool.

--color (string)

Turn on/off color output.

  • on
  • off
  • auto

--no-sign-request (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

--ca-bundle (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

--cli-read-timeout (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

--cli-connect-timeout (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

--v2-debug (boolean)

Enable AWS CLI v2 migration assistance. Prints warnings if the command would face a breaking change after swapping AWS CLI v1 for AWS CLI v2 in the current environment. Prints one warning for each breaking change detected.

Output

result -> (tagged union structure)

The result of the browser action. The member set in the result corresponds to the action that was performed.

Note

This is a Tagged Union structure. Only one of the following top level keys can be set: mouseClick, mouseMove, mouseDrag, mouseScroll, keyType, keyPress, keyShortcut, screenshot.

mouseClick -> (structure)

The result of a mouse click action.

status -> (string)

The status of the action execution.

error -> (string)

The error message. Present only when the action failed.

mouseMove -> (structure)

The result of a mouse move action.

status -> (string)

The status of the action execution.

error -> (string)

The error message. Present only when the action failed.

mouseDrag -> (structure)

The result of a mouse drag action.

status -> (string)

The status of the action execution.

error -> (string)

The error message. Present only when the action failed.

mouseScroll -> (structure)

The result of a mouse scroll action.

status -> (string)

The status of the action execution.

error -> (string)

The error message. Present only when the action failed.

keyType -> (structure)

The result of a key type action.

status -> (string)

The status of the action execution.

error -> (string)

The error message. Present only when the action failed.

keyPress -> (structure)

The result of a key press action.

status -> (string)

The status of the action execution.

error -> (string)

The error message. Present only when the action failed.

keyShortcut -> (structure)

The result of a key shortcut action.

status -> (string)

The status of the action execution.

error -> (string)

The error message. Present only when the action failed.

screenshot -> (structure)

The result of a screenshot action.

status -> (string)

The status of the action execution.

error -> (string)

The error message. Present only when the action failed.

data -> (blob)

The base64-encoded image data. Present only when the action succeeded.

sessionId -> (string)

The unique identifier of the browser session on which the action was performed.