Skip to content

/AWS1/IF_BDC=>INVOKEBROWSER()

About InvokeBrowser

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:

Method Signature

METHODS /AWS1/IF_BDC~INVOKEBROWSER
  IMPORTING
    !IV_BROWSERIDENTIFIER TYPE /AWS1/BDCSTRING OPTIONAL
    !IV_SESSIONID TYPE /AWS1/BDCBROWSERSESSIONID OPTIONAL
    !IO_ACTION TYPE REF TO /AWS1/CL_BDCBROWSERACTION OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_bdcinvokebrowserrsp
  RAISING
    /AWS1/CX_BDCACCESSDENIEDEX
    /AWS1/CX_BDCINTERNALSERVEREX
    /AWS1/CX_BDCRESOURCENOTFOUNDEX
    /AWS1/CX_BDCSERVICEQUOTAEXCDEX
    /AWS1/CX_BDCTHROTTLINGEX
    /AWS1/CX_BDCVALIDATIONEX
    /AWS1/CX_BDCCLIENTEXC
    /AWS1/CX_BDCSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_browseridentifier TYPE /AWS1/BDCSTRING /AWS1/BDCSTRING

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

iv_sessionid TYPE /AWS1/BDCBROWSERSESSIONID /AWS1/BDCBROWSERSESSIONID

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

io_action TYPE REF TO /AWS1/CL_BDCBROWSERACTION /AWS1/CL_BDCBROWSERACTION

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

RETURNING

oo_output TYPE REF TO /aws1/cl_bdcinvokebrowserrsp /AWS1/CL_BDCINVOKEBROWSERRSP

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->invokebrowser(
  io_action = new /aws1/cl_bdcbrowseraction(
    io_keypress = new /aws1/cl_bdckeypressarguments(
      iv_key = |string|
      iv_presses = 123
    )
    io_keyshortcut = new /aws1/cl_bdckeyshortcutargmnts(
      it_keys = VALUE /aws1/cl_bdckeylist_w=>tt_keylist(
        ( new /aws1/cl_bdckeylist_w( |string| ) )
      )
    )
    io_keytype = new /aws1/cl_bdckeytypearguments( |string| )
    io_mouseclick = new /aws1/cl_bdcmouseclickargmnts(
      iv_button = |string|
      iv_clickcount = 123
      iv_x = 123
      iv_y = 123
    )
    io_mousedrag = new /aws1/cl_bdcmousedragarguments(
      iv_button = |string|
      iv_endx = 123
      iv_endy = 123
      iv_startx = 123
      iv_starty = 123
    )
    io_mousemove = new /aws1/cl_bdcmousemovearguments(
      iv_x = 123
      iv_y = 123
    )
    io_mousescroll = new /aws1/cl_bdcmousescrollargmnts(
      iv_deltax = 123
      iv_deltay = 123
      iv_x = 123
      iv_y = 123
    )
    io_screenshot = new /aws1/cl_bdcscreenshotargmnts( |string| )
  )
  iv_browseridentifier = |string|
  iv_sessionid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_browseractionresult = lo_result->get_result( ).
  IF lo_browseractionresult IS NOT INITIAL.
    lo_mouseclickresult = lo_browseractionresult->get_mouseclick( ).
    IF lo_mouseclickresult IS NOT INITIAL.
      lv_browseractionstatus = lo_mouseclickresult->get_status( ).
      lv_string = lo_mouseclickresult->get_error( ).
    ENDIF.
    lo_mousemoveresult = lo_browseractionresult->get_mousemove( ).
    IF lo_mousemoveresult IS NOT INITIAL.
      lv_browseractionstatus = lo_mousemoveresult->get_status( ).
      lv_string = lo_mousemoveresult->get_error( ).
    ENDIF.
    lo_mousedragresult = lo_browseractionresult->get_mousedrag( ).
    IF lo_mousedragresult IS NOT INITIAL.
      lv_browseractionstatus = lo_mousedragresult->get_status( ).
      lv_string = lo_mousedragresult->get_error( ).
    ENDIF.
    lo_mousescrollresult = lo_browseractionresult->get_mousescroll( ).
    IF lo_mousescrollresult IS NOT INITIAL.
      lv_browseractionstatus = lo_mousescrollresult->get_status( ).
      lv_string = lo_mousescrollresult->get_error( ).
    ENDIF.
    lo_keytyperesult = lo_browseractionresult->get_keytype( ).
    IF lo_keytyperesult IS NOT INITIAL.
      lv_browseractionstatus = lo_keytyperesult->get_status( ).
      lv_string = lo_keytyperesult->get_error( ).
    ENDIF.
    lo_keypressresult = lo_browseractionresult->get_keypress( ).
    IF lo_keypressresult IS NOT INITIAL.
      lv_browseractionstatus = lo_keypressresult->get_status( ).
      lv_string = lo_keypressresult->get_error( ).
    ENDIF.
    lo_keyshortcutresult = lo_browseractionresult->get_keyshortcut( ).
    IF lo_keyshortcutresult IS NOT INITIAL.
      lv_browseractionstatus = lo_keyshortcutresult->get_status( ).
      lv_string = lo_keyshortcutresult->get_error( ).
    ENDIF.
    lo_screenshotresult = lo_browseractionresult->get_screenshot( ).
    IF lo_screenshotresult IS NOT INITIAL.
      lv_browseractionstatus = lo_screenshotresult->get_status( ).
      lv_string = lo_screenshotresult->get_error( ).
      lv_blob = lo_screenshotresult->get_data( ).
    ENDIF.
  ENDIF.
  lv_browsersessionid = lo_result->get_sessionid( ).
ENDIF.