AgentCore Browser icon

AgentCore Browser

Automate browser tasks using Amazon Bedrock AgentCore Browser and Playwright

Overview

This node automates browser tasks using Amazon Bedrock AgentCore Browser and Playwright. It supports running custom Playwright scripts on a specified URL, executing browser tasks from natural language instructions, and navigating to a URL to extract data. It is useful for scenarios like web scraping, automated testing, and data extraction from web pages. For example, users can run a script to get the page title, perform searches on e-commerce sites, or extract specific content from web pages.

Use Case Examples

  1. Run a custom Playwright script to retrieve the page title.
  2. Navigate to amazon.com, search for wireless headphones, and extract the top 3 product names and prices.
  3. Navigate to a URL and extract text or HTML content from specified selectors.

Properties

Name Meaning
Authentication Selects the authentication method to use, either standard AWS credentials or custom AgentCore Browser API credentials.
Browser Tool ARN The Amazon Resource Name (ARN) of the AgentCore Browser tool to use for the session.
Start URL The URL to navigate to at the start of the browser session.
Timeout (ms) Maximum time in milliseconds to wait for the operation to complete.
Script JavaScript/TypeScript code to execute in the browser context. The 'page' object is available for Playwright commands.
Screenshot Mode Determines when to capture screenshots during script execution: none, final page, or on error only.

Output

Binary

Screenshot image data in PNG format if screenshots are captured.

JSON

  • result - The result object returned from the executed Playwright script.
  • sessionInfo
    • browserId - Identifier of the browser instance used in the session.
    • sessionId - Identifier of the browser session.
  • screenshot - Binary data of the screenshot image if captured.

Dependencies

  • Amazon Bedrock AgentCore Browser service
  • Playwright library

Troubleshooting

  • Ensure valid AWS or AgentCore Browser API credentials are provided to avoid authentication errors.
  • Timeout errors may occur if the page takes too long to load; increase the Timeout (ms) parameter if needed.
  • Script errors may occur if the provided JavaScript code is invalid or references unavailable objects; verify the script syntax and usage of the 'page' object.
  • Screenshot capture may fail if the page is not fully loaded or if permissions are restricted; adjust screenshot mode or page load conditions.

Links

Discussion