Skip to main content

Robo

The Robo module provides comprehensive browser automation and web scraping capabilities for Soul. Built on top of the powerful Rod library, it offers a JavaScript-like API for controlling browsers, interacting with web pages, and extracting data. The module supports both headless and headed browser modes, making it perfect for web scraping, automated testing, and UI automation tasks.

Browser Management

Creating a Browser

Create a new browser instance with optional configuration:

Connecting to Existing Browser

Connect to an already running browser instance:

Browser Information

Get information about the browser:

Closing Browser

Close the browser when done:

Page Management

Creating Pages

Create new pages (tabs) in the browser:

Page Operations

Manage multiple pages:

Basic Navigation

Navigate to web pages:
Control browser navigation:

Element Selection

Finding Elements

Locate elements on the page using CSS selectors:

Waiting for Elements

Wait for elements to appear:

Element Interaction

Clicking Elements

Interact with clickable elements:

Form Interactions

Work with form elements:

Mouse and Keyboard Actions

Perform low-level input actions:

Data Extraction

Text Content

Extract text from elements:

Page Content

Extract page-level content:

Screenshots and Media

Taking Screenshots

Capture visual content:

JavaScript Execution

Running JavaScript

Execute JavaScript code in the browser:

Working with Cookies

Manage browser cookies:

Viewport and Device Emulation

Viewport Control

Control browser viewport:

Network and Requests

Request Interception

Control network requests:

Download Management

Configure file downloads:

Scrolling

Page Scrolling

Control page scrolling:

Frames and Windows

Frame Management

Work with iframes:

Timing and Waits

Wait Functions

Control timing in automation:

Complete Examples

Web Scraping Example

Form Automation Example

Multi-Page Scraping Example

Advanced Automation Example

Best Practices

  1. Resource Management: Always close browsers and pages when done
  2. Error Handling: Use try-catch blocks for robust automation
  3. Waits: Use appropriate wait functions instead of fixed delays
  4. Selectors: Use stable selectors (IDs, data attributes) over brittle ones
  5. Screenshots: Take screenshots for debugging and monitoring
  6. Headless Mode: Use headless mode for production scraping
The Robo module provides a complete solution for browser automation and web scraping in Soul, supporting everything from simple data extraction to complex multi-step automation workflows with stealth capabilities and comprehensive error handling.