Skip to content

acspace2/RobotDriver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RobotDriver — Login → Search → Report Price (+ MCP, API)

Core: Login → search a product → extract price

MCP Server: Execute LLM-generated JSON plans (/mcp/*)

Mini API: Query price over HTTP (/price, /price/quick)
Adapter for automationexercise.com is included; swap the adapter to target another site.

Project Layout

RobotDriver/Main.py — CLI: Login → Search → Price

RobotDriver/ApiServer.py — FastAPI: /health, /price, /price/quick

RobotDriver/MCPServer.py — FastAPI: /mcp/describe_page, /mcp/execute_plan

RobotDriver/Core/Session.py — Playwright BrowserSession

RobotDriver/Service/Login.py — AuthService (login + optional sign-up)

RobotDriver/Service/ProductPrice.py — CatalogService (search → price)

RobotDriver/Site/Base.py — SiteAdapter interface (strategy)

RobotDriver/Site/AutomationExercise.py — site adapter

RobotDriver/Util/Parsing.py — price text parser

Requirements

Python 3.10+ (3.12 recommended)

One-time browser install: python -m playwright install

Deps: pip install -r requirements.txt

Install

Windows (PowerShell)

py -3 -m venv .venv . .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt python -m playwright install 

Windows (CMD)

py -3 -m venv .venv .\.venv\Scripts\activate.bat pip install -r requirements.txt python -m playwright install 

macOS / Linux

python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt python -m playwright install 

Run (Core / CLI)

Existing account

python -m RobotDriver.Main --email "you@example.com" --password "yourpass" -p "Blue Top" --headful 

No account? Auto sign-up then proceed

python -m RobotDriver.Main --email "unique_123@example.com" --password "MyPass!123" -p "Blue Top" --signup-if-needed --headful 

Exit codes: 0 = success (found+priced), 2 = logical failure (login/product/price)

Run (Mini API)

Start server

uvicorn RobotDriver.ApiServer:app --host 0.0.0.0 --port 8000 

Health

curl http://127.0.0.1:8000/health 

Price

curl -X POST http://127.0.0.1:8000/price -H "Content-Type: application/json" \ -d '{"email":"you@example.com","password":"yourpass","product":"Blue Top"}' 

Quick demo (env vars)
PowerShell

$env:AE_EMAIL="you@example.com" $env:AE_PASSWORD="yourpass" curl "http://127.0.0.1:8000/price/quick?product=Blue%20Top" 

CMD

set AE_EMAIL=you@example.com set AE_PASSWORD=yourpass curl "http://127.0.0.1:8000/price/quick?product=Blue%20Top" 

macOS/Linux

export AE_EMAIL=you@example.com export AE_PASSWORD=yourpass curl "http://127.0.0.1:8000/price/quick?product=Blue%20Top" 

Run (MCP)

Start server

uvicorn RobotDriver.MCPServer:app --host 0.0.0.0 --port 8001 

Describe

curl "http://127.0.0.1:8001/mcp/describe_page?url=https://automationexercise.com/products&depth=2" 

Execute plan

curl -X POST http://127.0.0.1:8001/mcp/execute_plan \ -H "Content-Type: application/json" -d @plan.json 

plan.json example

{ "headless": true, "steps": [ {"action":"goto","url":"https://automationexercise.com/login"}, {"action":"fill","role":"textbox","name":"Email Address","text":"you@example.com"}, {"action":"fill","role":"textbox","name":"Password","text":"yourpass"}, {"action":"click","selector":"button[data-qa='login-button']"}, {"action":"goto","url":"https://automationexercise.com/products"}, {"action":"fill","selector":"#search_product","text":"Blue Top"}, {"action":"click","selector":"#submit_search"}, {"action":"wait_for","selector":".features_items"}, {"action":"click","selector":".productinfo.text-center:has-text('Blue Top') a:has-text('View Product')"}, {"action":"wait_for","selector":".product-information"}, {"action":"read_text","selector":".product-information span.price"} ] } 

How It Works

BrowserSession: context manager (Chromium, context/page, timeouts, cleanup)

SiteAdapter: strategy interface; AutomationExerciseAdapter implements login/sign-up/search/price

AuthService / CatalogService: site-agnostic orchestration

Troubleshooting

ModuleNotFoundError: RobotDriver → run from repo root: python -m RobotDriver.Main ...

Browsers missingpython -m playwright install

Timeouts → increase timeouts in Core/Session.py or add wait_for_* in adapter

Security

Do not commit real credentials. Use AE_EMAIL / AE_PASSWORD env vars for demos.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages