| Crates.io | isoautomate |
| lib.rs | isoautomate |
| version | 0.1.0 |
| created_at | 2026-01-12 12:38:06.344889+00 |
| updated_at | 2026-01-12 12:38:06.344889+00 |
| description | Official Rust SDK for the isoAutomate Sovereign Browser Infrastructure. |
| homepage | |
| repository | https://github.com/isoautomate/isoautomate-rust |
| max_upload_size | |
| id | 2037662 |
| size | 79,032 |
Add this to your Cargo.toml:
[dependencies]
isoautomate = "0.1.0"
tokio = { version = "1", features = ["full"] } # Required for async runtime
The SDK requires a connection to a Redis instance to communicate with the browser engine. You can configure this via an environment variable (.env file) or rely on defaults.
Method A: Environment Variables (.env)
Create a .env file in your project root.
REDIS_URL=redis://:yourpassword@localhost:6379/0
Method B: Default Connection
If no configuration is provided, the SDK defaults to redis://127.0.0.1:6379.
Browser sessions are managed through the BrowserClient. Since all operations are asynchronous, you must use an async runtime like tokio.
use isoautomate::{BrowserClient, IsoError};
#[tokio::main]
async fn main() -> Result<(), IsoError> {
// 1. Connect to Redis (loads .env automatically)
let mut browser = BrowserClient::new().await?;
// 2. Acquire a browser (Chrome, with Video recording enabled)
println!("Acquiring browser...");
browser.acquire("chrome", true, false, None).await?;
// 3. Navigate & Interact
browser.open_url("[https://example.com](https://example.com)").await?;
browser.assert_text("Example Domain", "h1").await?;
println!("Page Title: {:?}", browser.get_title().await?);
// 4. Cleanup (Crucial step!)
println!("Releasing browser...");
let info = browser.release().await?;
// 5. Access session video URL
if let Some(video_url) = &browser.video_url {
println!("Session Video: {}", video_url);
}
Ok(())
}
The .acquire() method claims a browser from your remote fleet.
pub async fn acquire(
&mut self,
browser_type: &str, // "chrome", "brave", "chrome_profiled"
video: bool, // Record MP4 video?
record: bool, // Record DOM events (RRWeb)?
profile: Option<String> // Persistence Profile ID
) -> Result<Value, IsoError>
To keep cookies and logins across sessions, provide a profile string.
// Use a persistent profile named "marketing_bot_1"
browser.acquire("chrome", false, false, Some("marketing_bot_1".to_string())).await?;
All actions are async and return Result<Value, IsoError>.
| Method | Arguments | Description |
|---|---|---|
open_url(url) |
&str |
Navigates to the website. |
reload(ignore_cache) |
bool |
Reloads the page. |
refresh() |
- | Standard page refresh. |
go_back() |
- | History back. |
go_forward() |
- | History forward. |
internalize_links() |
- | Forces target="_blank" links to open in the current tab. |
get_navigation_history() |
- | Returns history list. |
browser.open_url("[https://isoautomate.com](https://isoautomate.com)").await?;
browser.reload(true).await?; // Hard reload
| Method | Arguments | Description |
|---|---|---|
click(selector) |
&str |
Clicks an element. |
click_if_visible(selector) |
&str |
Clicks only if visible. |
click_visible_elements(sel, limit) |
&str, u32 |
Clicks limit visible elements (0 = all). |
click_nth_element(sel, n) |
&str, u32 |
Clicks the Nth match found in DOM. |
click_nth_visible_element(sel, n) |
&str, u32 |
Clicks the Nth visible match. |
click_link(text) |
&str |
Clicks link by text content. |
click_active_element() |
- | Clicks focused element. |
double_click(selector) |
&str |
Double clicks element. |
right_click(selector) |
&str |
Context click. |
hover(selector) |
&str |
Hovers over element. |
nested_click(parent, child) |
&str, &str |
Scopes click to child of parent. |
click_with_offset(sel, x, y, c) |
&str, i32, i32, bool |
Clicks at offset coordinates. |
drag_and_drop(drag, drop) |
&str, &str |
Drags element 1 to element 2. |
browser.click("#submit-btn").await?;
browser.click_nth_visible_element(".add-to-cart", 2).await?;
| Method | Arguments | Description |
|---|---|---|
type_text(sel, text) |
&str, &str |
Rapid text entry. (Note: renamed from type in Python). |
press_keys(sel, keys) |
&str, &str |
Human-like typing with events. |
send_keys(sel, keys) |
&str, &str |
Standard automation key send. |
set_value(sel, val) |
&str, &str |
Sets HTML value attribute directly. |
clear(selector) |
&str |
Clears input field. |
clear_input(selector) |
&str |
Specific clear for <input>. |
submit(selector) |
&str |
Submits form containing element. |
focus(selector) |
&str |
Focuses element. |
browser.type_text("#search", "Rust SDK").await?;
browser.press_keys("#password", "secure123").await?; // Slower, human-like
browser.submit("#login-form").await?;
Requires _profiled browser type.
| Method | Arguments | Description |
|---|---|---|
gui_click_element(sel, time) |
&str, f64 |
Moves OS mouse to element and clicks. |
gui_click_x_y(x, y) |
u32, u32 |
Clicks raw pixel coordinates. |
gui_hover_element(sel) |
&str |
Moves OS mouse to hover element. |
gui_drag_and_drop(d, d, t) |
&str, &str, f64 |
Hardware drag gesture. |
gui_write(text) |
&str |
Hardware keyboard typing. |
gui_press_keys(keys) |
Vec<String> |
Hardware key combos (e.g., Ctrl+C). |
gui_click_captcha() |
- | Auto-clicks captcha checkboxes physically. |
solve_captcha() |
- | Trigger captcha solver. |
browser.gui_click_element("#login-btn", 0.5).await?;
browser.gui_write("Hardware typing").await?;
| Method | Arguments | Description |
|---|---|---|
select_option_by_text(sel, txt) |
&str, &str |
Select by visible text. |
select_option_by_value(sel, val) |
&str, &str |
Select by HTML value. |
select_option_by_index(sel, idx) |
&str, u32 |
Select by index. |
| Method | Arguments | Description |
|---|---|---|
open_new_tab(url) |
&str |
Opens new tab. |
open_new_window(url) |
&str |
Opens new window. |
switch_to_tab(idx) |
i32 |
Switch tab (-1 for last). |
switch_to_window(idx) |
i32 |
Switch window. |
close_active_tab() |
- | Closes current tab. |
maximize() |
- | Maximizes window. |
minimize() |
- | Minimizes window. |
set_window_size(w, h) |
u32, u32 |
Sets viewport size. |
set_window_rect(x,y,w,h) |
i32, i32, u32, u32 |
Sets window position & size. |
| Method | Arguments | Description |
|---|---|---|
get_text(selector) |
&str |
Gets visible text. |
get_title() |
- | Gets page title. |
get_current_url() |
- | Gets URL. |
get_page_source() |
- | Gets HTML source string. |
save_page_source_file(name) |
Option<&str> |
Saves HTML to local file. |
get_html(selector) |
&str |
Gets inner HTML. |
get_attribute(sel, attr) |
&str, &str |
Gets attribute value. |
get_element_attributes(sel) |
&str |
Gets all attributes map. |
get_user_agent() |
- | Gets UA string. |
get_element_rect(sel) |
&str |
Gets x, y, w, h of element. |
is_element_visible(sel) |
&str |
Returns boolean. |
is_text_visible(text) |
&str |
Returns boolean. |
let price = browser.get_text(".price").await?;
let src = browser.get_attribute("img", "src").await?;
| Method | Arguments | Description |
|---|---|---|
get_all_cookies() |
- | Returns all cookies. |
add_cookie(json) |
Value |
Adds a cookie (JSON object). |
delete_cookie(name) |
&str |
Deletes cookie. |
clear_cookies() |
- | Clears all cookies. |
save_cookies(name) |
Option<&str> |
Saves cookies to local JSON file. |
load_cookies(name, list) |
Option<&str>, Option |
Loads cookies from file or JSON. |
get_local_storage_item(key) |
&str |
Gets local storage value. |
set_local_storage_item(k, v) |
&str, &str |
Sets local storage. |
Assertions automatically save a screenshot to screenshots/failures/ if they fail.
| Method | Arguments | Description |
|---|---|---|
sleep(seconds) |
f64 |
Pauses execution. |
wait_for_element(sel, timeout) |
&str, Option<u64> |
Waits for element. |
wait_for_text(text, sel, tm) |
&str, &str, Option |
Waits for text. |
assert_element(sel) |
&str |
Errors if element missing. |
assert_text(text, sel) |
&str, &str |
Errors if text missing. |
assert_url(substring) |
&str |
Errors if URL mismatch. |
browser.wait_for_element("#dashboard", Some(15)).await?;
browser.assert_text("Success", ".alert").await?;
| Method | Arguments | Description |
|---|---|---|
execute_script(script) |
&str |
Runs JS in browser. |
evaluate(expr) |
&str |
Returns JS expression value. |
screenshot(sel, name) |
Option, Option |
Saves screenshot to file. |
save_as_pdf(name) |
&str |
Saves page as PDF. |
upload_file(sel, path) |
&str, &str |
Uploads local file to input. |
execute_cdp_cmd(cmd, params) |
&str, Value |
God Mode: Raw CDP access. |
get_mfa_code(key) |
&str |
Generates TOTP code. |
enter_mfa_code(sel, key) |
&str, &str |
Types TOTP code. |
block_urls(patterns) |
Vec<String> |
Blocks network requests. |
// Execute JS
let val = browser.evaluate("window.innerWidth").await?;
// Upload File
browser.upload_file("input[type='file']", "./photo.jpg").await?;
// God Mode (CDP)
browser.execute_cdp_cmd("Network.clearBrowserCache", json!({})).await?;
This project is licensed under the MIT License. Built for the isoAutomate platform.