Actions8
- Browser Rest Apis Actions
Overview
This node interacts with the Browserless API to perform browser automation tasks such as navigating to URLs, waiting for elements or events, injecting scripts or styles, setting HTTP headers, authenticating, and controlling browser behavior. It is useful for web scraping, automated testing, and browser-based data extraction workflows.
Use Case Examples
- Navigate to a webpage and wait for a specific element to load before extracting content.
- Inject custom JavaScript or CSS into a page to modify its appearance or behavior before scraping.
- Set custom HTTP headers and cookies to simulate authenticated sessions or specific user agents.
Properties
| Name | Meaning |
|---|---|
| Url | The URL to navigate to in the browser. |
| Wait For Timeout | Time in milliseconds to wait before proceeding. |
| Wait For Selector | Wait for a specific DOM element to appear or become visible/hidden. |
| Goto Options | Options for navigating to a URL, including referer, timeout, and wait conditions. |
| Wait For Event | Wait for a specific browser event to occur. |
| Wait For Function | Wait for a JavaScript function to evaluate to true in the browser context. |
| Add Script Tag | Inject JavaScript into the page via URL, path, or content. |
| Add Style Tag | Inject CSS styles into the page via URL, path, or content. |
| Set Extra HTTP Headers | Set additional HTTP headers for requests. |
| Authenticate | Provide username and password for HTTP authentication. |
| Viewport | Set the browser viewport size and characteristics. |
| Emulate Media Type | Emulate a specific media type like screen or print. |
| Timeout | Override the system-level timeout for the request in milliseconds. |
| Html | Provide raw HTML content to load instead of navigating to a URL. |
| User Agent | Set a custom user agent string for the browser. |
| Best Attempt | Attempt to proceed even if awaited events fail or timeout. |
| Enable Cookies | Enable or disable cookie handling. |
| Cookies | Array of cookie objects to set in the browser session. |
| Block Ads | Enable or disable ad-blocking extensions during the session. |
| Set Java Script Enabled | Enable or disable JavaScript execution on the page. |
| Enable Launch | Launch a new browser instance for the session. |
| Launch | Options for launching the browser instance, such as args, viewport, headless mode, and more. |
| Reject Resource Types | Resource types to block from loading, e.g., images, scripts. |
| Reject Request Pattern | Patterns of requests to block from loading. |
| Request Interceptors | Intercept and mock responses for matching request patterns. |
| Use Custom Body | Whether to use a fully custom request body instead of individual parameters. |
| Custom Body | Custom JSON body to send to the Browserless API. |
Output
JSON
content- The content retrieved or generated by the browser session, such as HTML or extracted data.status- Status of the browser operation or HTTP response.cookies- Cookies set or retrieved during the session.headers- HTTP headers involved in the request or response.
Dependencies
- Browserless API
Troubleshooting
- Timeout errors if the page takes too long to load or events do not fire within specified timeouts. Increase timeout values or use 'bestAttempt' to proceed despite failures.
- Authentication failures if incorrect username or password is provided. Verify credentials.
- Issues with resource blocking or request interception causing pages to not load properly. Adjust 'Reject Resource Types' and 'Request Interceptors' settings.
- Problems with script or style injection if URLs or content are invalid. Ensure valid script/style sources.
Links
- Browserless API Documentation - Official documentation for the Browserless API used by this node.