scitex_browser.collaboration
scitex_browser.collaboration - Interactive browser automation for AI-human teams.
This is a NEW module that does NOT affect existing scitex.browser functionality.
Features: - Persistent shared browser sessions - Multi-agent coordination - AI-human collaboration - Authentication handling - Content extraction
Version: 0.1.0-alpha (experimental)
Bases:
objectPersistent browser session shared between AI agents and humans.
Simple, incremental start - just the basics.
Example
# Start session session = SharedBrowserSession() await session.start()
# Navigate await session.navigate(”http://127.0.0.1:8000”)
# Take screenshot screenshot = await session.screenshot()
# Keep running await session.wait()
# Close when done await session.close()
Initialize shared session.
Start the persistent browser session.
Uses persistent context pattern from ScholarBrowserManager.
Navigate to URL.
Take screenshot and save to scitex.capture directory.
- Return type:
- Returns:
Path to screenshot file
Wait for duration or until stopped.
Close the session.
Context manager entry.
Context manager exit.
Simple event logging.
Automatically take screenshots at intervals.
Get session information.
- Return type:
Type text like a human (with delay between keys).
Click element.
Hover over element.
Press keyboard key (Enter, Tab, Escape, etc.).
Scroll down.
Scroll element into view.
Wait for element to appear.
Wait for text to appear.
Wait for URL to match pattern.
Get text content of element.
- Return type:
Get value of input element.
- Return type:
Check if element is visible.
- Return type:
Ask user a question in the browser.
Returns user’s response.
Example
response = await session.ask(“What username to use?”) response = await session.ask(“Choose:”, [“Option A”, “Option B”])
- Return type:
Ask user for confirmation in browser.
Returns True if user clicks OK, False if Cancel.
- Return type:
- class scitex_browser.collaboration.SessionConfig(session_id='default', browser_type='chromium', headless=False, viewport=<factory>, user_data_dir=None, enable_screenshots=True, screenshot_interval=None)[source]
Bases:
objectConfiguration for shared browser session.
- __init__(session_id='default', browser_type='chromium', headless=False, viewport=<factory>, user_data_dir=None, enable_screenshots=True, screenshot_interval=None)
- class scitex_browser.collaboration.VisualFeedback(page)[source]
Bases:
objectSimple visual feedback overlay on browser.
Shows: - Who’s in control - What action is being performed - Status messages
- class scitex_browser.collaboration.CredentialManager(verbose=True)[source]
Bases:
objectFlexible credential retrieval.
Tries multiple sources in order: 1. Explicitly provided credentials 2. Environment variables 3. Terminal prompt (if terminal available) 4. Browser prompt (if browser available)
Always clearly communicates what it’s doing!
- async get_credential(name, env_var=None, prompt_text=None, page=None, mask=False)[source]
Get credential from best available source.
- Parameters:
- Return type:
- Returns:
Credential value
Example
- username = await creds.get_credential(
name=”username”, env_var=”SCITEX_CLOUD_USERNAME”, prompt_text=”Django username”, page=page,
)
- class scitex_browser.collaboration.GoogleAuthHelper(email=None, password=None, debug=False)[source]
Bases:
objectGoogle OAuth authentication helper.
Handles the popup-based Google OAuth flow used by many services.
- Environment Variables:
GOOGLE_EMAIL: Default email if not provided GOOGLE_PASSWORD: Default password if not provided
- async login_via_google_button(page, google_button_selector='button:has-text("Continue with Google")', timeout=60000)[source]
Perform Google OAuth login via a “Continue with Google” button.
This handles the popup-based OAuth flow: 1. Click the Google button on the main page 2. Handle the Google popup for email/password entry 3. Wait for redirect back to the original service
- async _handle_consent_screens(popup)[source]
Handle OAuth consent or ‘Continue’ screens that may appear.
- Return type:
- async _wait_for_2fa(popup, timeout=60000)[source]
Wait for 2FA verification to complete.
Detects 2FA screens and waits for user to approve on their device.
- async scitex_browser.collaboration.google_login(page, email, password, button_selector='button:has-text("Continue with Google")', debug=False)[source]
Quick Google OAuth login.
- Parameters:
- Return type:
- Returns:
True if login successful, False otherwise
Example
success = await google_login(page, “user@gmail.com”, “password”)