Gathering detailed insights and metrics for @sashbot/uibridge
Gathering detailed insights and metrics for @sashbot/uibridge
Gathering detailed insights and metrics for @sashbot/uibridge
Gathering detailed insights and metrics for @sashbot/uibridge
npm install @sashbot/uibridge
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
1
4
Primary Method: Use PowerShell helper functions for reliable, tested browser automation with built-in error handling and JSON validation.
UIBridge provides reliable browser automation specifically designed for AI agents. It runs automation against a real browser with visual feedback and comprehensive error handling.
Perfect for: AI agents, automation testing, web scraping, form filling, UI testing.
1npm install @sashbot/uibridge
1# Start the UIBridge server (keep this running) 2node node_modules/@sashbot/uibridge/api-server.cjs
✅ Server Status: You should see UIBridge API Server running on http://localhost:3002
1# Download the helper functions (includes JSON corruption fixes) 2curl -o uibridge-powershell-helpers.ps1 https://unpkg.com/@sashbot/uibridge@latest/uibridge-powershell-helpers.ps1 3 4# Load the functions (do this first in every session) 5. .\uibridge-powershell-helpers.ps1
1# Test server connection 2Test-UIBridgeServer 3 4# Start a complete automation session (opens browser and takes screenshot) 5Start-UIBridgeSession -Url "https://example.com"
🎉 That's it! You now have reliable browser automation with proper error handling.
1# Always load helpers first in every session 2. .\uibridge-powershell-helpers.ps1 3 4# Test server connection 5Test-UIBridgeServer 6 7# Navigate to any URL 8Open-UIBridgePage -Url "https://example.com" 9Open-UIBridgePage -Url "http://localhost:3000" 10 11# Get current page information 12Get-UIBridgePageInfo
1# Click by text content (RECOMMENDED - most reliable) 2Click-UIBridgeText -Text "Submit" 3Click-UIBridgeText -Text "Login" 4Click-UIBridgeText -Text "Save Changes" 5 6# Click by test ID (best for testing) 7Click-UIBridgeTestId -TestId "submit-btn" 8Click-UIBridgeTestId -TestId "login-button" 9 10# Click by CSS selector (when other methods don't work) 11Click-UIBridgeElement -Selector "#save-button" 12Click-UIBridgeElement -Selector ".submit-btn" 13Click-UIBridgeElement -Selector "button[type='submit']"
1# Basic screenshot (recommended) 2Take-UIBridgeScreenshot 3 4# Full page screenshot with options 5Take-UIBridgeScreenshot -FullPage $true -Format "png" -Quality 90 6 7# Screenshot with specific background color 8Take-UIBridgeScreenshot -BackgroundColor "white" 9Take-UIBridgeScreenshot -BackgroundColor "transparent" 10Take-UIBridgeScreenshot -BackgroundColor "auto" # Auto-detect page background 11 12# List all saved screenshots 13Get-UIBridgeScreenshots
1# Complete automation session with error handling 2Start-UIBridgeSession -Url "https://example.com" 3 4# Example: Form automation workflow 5. .\uibridge-powershell-helpers.ps1 6Test-UIBridgeServer 7Open-UIBridgePage -Url "https://example.com/form" 8Take-UIBridgeScreenshot # Before 9Click-UIBridgeText -Text "Fill Form" 10Take-UIBridgeScreenshot # After 11Click-UIBridgeTestId -TestId "submit-btn" 12Take-UIBridgeScreenshot # Final result 13Get-UIBridgeScreenshots # Review all screenshots
Click-UIBridgeText -Text "Submit"
instead of complex JSON1# Run tests to verify everything works
2pwsh -ExecutionPolicy Bypass -File test-powershell-helpers.ps1
The PowerShell helpers are the recommended primary method, but use alternatives for these specific scenarios:
Use when: You need to see automation happen in real-time in your own browser
1<!-- Add to your web app for live visual feedback --> 2<script src="http://localhost:3002/uibridge-client.js"></script>
1# Download live session helpers 2curl -o uibridge-live-session-helpers.ps1 https://unpkg.com/@sashbot/uibridge@latest/uibridge-live-session-helpers.ps1 3. .\uibridge-live-session-helpers.ps1 4 5# Control YOUR browser live 6Click-UIBridgeLiveText -Text "Submit" # You see it happen in your browser!
Use when:
1# Direct HTTP for other languages 2curl -X POST http://localhost:3002/execute \ 3 -H "Content-Type: application/json" \ 4 -d '{"command":"click","selector":{"text":"Submit"}}'
Use when: Building JavaScript/TypeScript applications with UIBridge
1import { UIBridge } from '@sashbot/uibridge'; 2const bridge = new UIBridge(); 3await bridge.click({ text: 'Submit' });
✅ FIXED in v1.2.5+ The PowerShell helpers now generate valid JSON consistently:
1# Verify the fix works
2pwsh -ExecutionPolicy Bypass -File test-powershell-helpers.ps1
3# Should show: All tests passed! ✅
1Test-UIBridgeServer 2# If this fails: 3# 1. Restart server: node node_modules/@sashbot/uibridge/api-server.cjs 4# 2. Check firewall/antivirus blocking port 3002 5# 3. Try different port: . .\uibridge-powershell-helpers.ps1 -ServerUrl "http://localhost:3003"
1# Try multiple strategies in order: 2Click-UIBridgeText -Text "Button Text" # Try this first (most reliable) 3Click-UIBridgeTestId -TestId "button-id" # If text doesn't work 4Click-UIBridgeElement -Selector "#button-id" # If test ID doesn't work 5 6# Take screenshot to see current page state 7Take-UIBridgeScreenshot
1# These all work correctly with the fixed helpers: 2Click-UIBridgeText -Text "Text with ""quotes"" and 'apostrophes'" 3Click-UIBridgeText -Text "Button with emoji 🚀" 4Click-UIBridgeText -Text "Unicode: 测试 العربية русский"
1# 1. Always load helpers first 2. .\uibridge-powershell-helpers.ps1 3 4# 2. Test connection before automating 5Test-UIBridgeServer 6 7# 3. Use text-based clicking first (most reliable) 8Click-UIBridgeText -Text "Submit" 9 10# 4. Take screenshots to verify actions 11Take-UIBridgeScreenshot 12 13# 5. Use complete workflows 14Start-UIBridgeSession -Url "https://example.com"
Test-UIBridgeServer
- always verify connectionFunction | Purpose | Example |
---|---|---|
Test-UIBridgeServer | Check server connection | Test-UIBridgeServer |
Open-UIBridgePage | Navigate to URL | Open-UIBridgePage -Url "https://example.com" |
Take-UIBridgeScreenshot | Capture page screenshot | Take-UIBridgeScreenshot -FullPage $true |
Click-UIBridgeText | Click by text content | Click-UIBridgeText -Text "Submit" |
Click-UIBridgeTestId | Click by test ID | Click-UIBridgeTestId -TestId "submit-btn" |
Click-UIBridgeElement | Click by CSS selector | Click-UIBridgeElement -Selector "#btn" |
Get-UIBridgePageInfo | Get page title/URL | Get-UIBridgePageInfo |
Get-UIBridgeScreenshots | List saved screenshots | Get-UIBridgeScreenshots |
Start-UIBridgeSession | Complete automation setup | Start-UIBridgeSession -Url "https://example.com" |
1# Custom timeout for slow pages 2Click-UIBridgeText -Text "Submit" -Timeout 10000 3 4# High quality screenshot 5Take-UIBridgeScreenshot -Quality 95 -Format "png" 6 7# Multiple screenshots for comparison 8Take-UIBridgeScreenshot # Before action 9Click-UIBridgeText -Text "Change Background" 10Take-UIBridgeScreenshot # After action
1# Test JSON generation and helper functions
2pwsh -ExecutionPolicy Bypass -File test-powershell-helpers.ps1
3
4# Expected result:
5# 📊 Test Results Summary
6# Total Tests: 17
7# Passed: 17 ✅
8# Failed: 0 ✅
1# In your build scripts
2$testResult = & pwsh -ExecutionPolicy Bypass -File test-powershell-helpers.ps1
3if ($LASTEXITCODE -ne 0) {
4 throw "UIBridge PowerShell helper tests failed"
5}
Click-UIBridgeText -Text "Submit"
instead of complex APIs🌉 Built for AI Agents: UIBridge provides the most reliable browser automation for AI agents with comprehensive error handling, JSON validation, and intuitive PowerShell functions.
No vulnerabilities found.
No security vulnerabilities found.