Browserless icon

Browserless

Browserless API

Overview

This node allows executing custom JavaScript code within a browser context using the Browserless API. It is useful for automating browser tasks, scraping web data, or running scripts in a headless browser environment. Users can provide the code to execute, configure browser launch options, control ad-blocking, set timeouts, and customize the request body.

Use Case Examples

  1. Running a script to scrape data from a webpage and return JSON results.
  2. Automating form submissions or interactions on a website using custom JavaScript.
  3. Testing web page behavior by executing scripts in a controlled browser environment.

Properties

Name Meaning
Code The JavaScript code to execute in the browser context.
Context JSON object providing context or variables accessible to the executed code.
Timeout Override the system-level timeout for the request in milliseconds.
Block Ads Whether to load ad-blocking extensions (uBlock Origin) during the session to block ads.
Enable Launch Whether to launch a new browser instance for the execution.
Launch Configuration options for launching the browser instance, including arguments, viewport settings, devtools, headless mode, and other browser launch parameters.
Use Custom Body Whether to use a custom JSON body for the request instead of the default structure.
Custom Body Custom JSON body to send with the request when 'Use Custom Body' is enabled.
Request Options Additional request options such as batching, SSL certificate validation, proxy settings, and timeout for the HTTP request.

Output

JSON

  • hello - A sample key from the executed code's returned JSON object.
  • type - The content type of the response from the executed code.

Dependencies

  • Browserless API

Troubleshooting

  • Ensure the JavaScript code provided is valid and returns a JSON-serializable object to avoid execution errors.
  • If the browser fails to launch, check the 'Enable Launch' and 'Launch' configuration options for correctness.
  • Ad-blocking may cause some sites to not load properly; disable 'Block Ads' if experiencing loading issues.
  • Timeout errors may occur if the script takes longer than the specified timeout; increase the timeout value if needed.
  • If SSL certificate validation fails, enable 'Ignore SSL Issues' in request options or configure a valid proxy.

Links

Discussion