Scrapybara icon

Scrapybara

Interact with the Scrapybara API

Overview

This node integrates with the Scrapybara API to manage and interact with virtual instances, specifically focusing on performing computer actions on these instances. The "Computer Action" operation allows users to remotely control an instance's mouse and keyboard, take screenshots, get cursor positions, scroll, wait, and type text or press keys programmatically.

Common scenarios where this node is beneficial include:

  • Automating GUI interactions on remote virtual machines or browser instances.
  • Running automated tests that require simulating user input.
  • Capturing screenshots or streaming the desktop of a remote instance.
  • Executing complex sequences of mouse and keyboard events for automation workflows.

Practical examples:

  • Move the mouse cursor to specific coordinates and click a button on a remote Windows instance.
  • Type a string of text into an active window on a Linux Ubuntu instance.
  • Take a screenshot of the current desktop state after performing some UI automation steps.
  • Scroll through a webpage or document in a browser instance by sending scroll commands.

Properties

Name Meaning
Instance ID The unique identifier of the instance on which the action will be performed.
Action The type of computer action to perform. Options: Key, Type, Mouse Move, Mouse Click, Screenshot, Cursor Position, Wait, Scroll.
Text (For "Type" action) The text to type into the active window.
Keys (For "Key" action) Comma-separated keys to press as a combination.
Button (For "Mouse Click" action) Which mouse button to click. Options: Left, Right, Middle, Back, Forward.
Number of Clicks (For "Mouse Click" action) How many times to click the mouse button.
Hold Keys (For applicable actions) Comma-separated keys to hold down while performing the action.
Coordinates [x, y] (For mouse-related actions) The X and Y coordinates for mouse move, click, or scroll actions.
Delta X (For "Scroll" action) Horizontal scroll amount.
Delta Y (For "Scroll" action) Vertical scroll amount.

Output

The output JSON object contains:

  • success: Boolean indicating if the action was successful.
  • instanceId: The ID of the instance on which the action was performed.
  • result: The detailed result returned from the Scrapybara API for the action, which may include:
    • For screenshot actions: image data or a reference to the screenshot.
    • For cursor position: current mouse coordinates.
    • For key presses, typing, mouse clicks, scrolling, waiting: status or error information.

If the action fails, an error message is thrown describing the failure.

No binary data output is explicitly handled by the node; screenshots are returned as part of the JSON result.

Dependencies

  • Requires an API key credential for authenticating with the Scrapybara API.
  • The node depends on the external scrapybara npm package to communicate with the Scrapybara service.
  • Proper network access to the Scrapybara API endpoint is necessary.
  • No additional environment variables are required beyond the API key credential.

Troubleshooting

  • Common issues:

    • Invalid or missing instance ID: Ensure the instance ID provided exists and is active.
    • Network or authentication errors: Verify the API key credential is valid and has proper permissions.
    • Unsupported actions for the instance type: Some actions might not be supported depending on the instance OS or configuration.
    • Incorrect coordinate values: Coordinates must be within the screen bounds of the instance.
  • Error messages:

    • "Failed to perform computer action on instance <ID>: <error message>": Indicates the action could not be completed. Check the error message for details such as invalid parameters or communication failures.
    • "Failed to stop/pause/resume instance <ID>: <error message>": Occurs when lifecycle operations fail, possibly due to instance state or permissions.
    • "Failed to run bash command on instance <ID>: <error message>": Bash command execution failed; verify the command syntax and instance readiness.
  • To resolve errors, confirm all input parameters are correct, the instance is reachable, and the API key is valid.

Links and References

Discussion