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 navigating to URLs, performing actions like clicking or typing, extracting data from web pages, running custom scripts, and capturing screenshots. It is useful for web scraping, automated testing, and data extraction workflows.

Use Case Examples

  1. Navigate to a product page, extract product titles and prices using CSS selectors.
  2. Run a custom Playwright script to interact with a web page and return specific data.
  3. Execute natural language instructions to perform complex browser tasks like searching and extracting results.

Properties

Name Meaning
Authentication Selects the authentication method to use, either AWS credentials or custom AgentCore Browser API credentials.
Browser Tool ARN ARN of the AgentCore Browser tool to use for the session.
Start URL The initial URL to navigate to when starting the browser session.
Timeout (ms) Maximum time in milliseconds to wait for operations to complete.
Selector CSS selector to identify elements from which to extract data.
Extract Mode Defines what to extract from the selected elements: text content, HTML, or a specific attribute.
Attribute Name Name of the attribute to extract when 'Extract Mode' is set to 'Attribute'.
Wait for Selector CSS selector to wait for before starting data extraction.
Actions A collection of actions to perform before extraction, such as clicking elements, typing text, waiting, or pressing keys.
Take Screenshot Whether to capture a screenshot of the page after extraction.
Full Page Screenshot Whether to capture the entire page or just the viewport when taking a screenshot.

Output

Binary

Screenshot image data if 'Take Screenshot' is enabled.

JSON

  • data - Extracted data from the page based on the selector and extract mode.
  • url - The URL of the page after navigation.
  • title - The title of the page after navigation.
  • results - Search results extracted when using agent instructions with search queries.
  • instructions - The natural language instructions provided for the browser actions.
  • searchQuery - The search query extracted from instructions if applicable.
  • result - Result of executing a custom script.
  • sessionInfo
    • browserId - Identifier of the browser session.
    • sessionId - Identifier of the session.
  • error - Error message if the operation fails and 'Continue On Fail' is enabled.

Dependencies

  • Amazon Bedrock AgentCore Browser service
  • AWS credentials or custom AgentCore Browser API credentials

Troubleshooting

  • Ensure correct AWS or AgentCore Browser API credentials are provided to avoid authentication errors.
  • Timeout errors may occur if the page or selector takes too long to load; increase the timeout parameter if needed.
  • CSS selectors must be accurate to extract the intended data; verify selectors in a browser's developer tools.
  • If extraction mode is 'attribute', ensure the attribute name is correctly specified.
  • When running custom scripts, syntax errors or runtime exceptions may occur; validate scripts before use.

Links

Discussion