auto-account-machine/browser-automation-ts/QUICK-START.md
2025-11-21 17:59:49 +08:00

144 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 快速开始 - 5分钟运行你的第一个自动化
## ⚡ 3步开始
### 步骤1安装依赖
```bash
cd browser-automation-ts
npm install
```
### 步骤2复制配置文件
```bash
# 将windsurf.yaml复制到configs目录
cp ../src/tools/automation-framework/configs/sites/windsurf.yaml configs/sites/
```
### 步骤3运行
```bash
# 设置必需的环境变量
export ADSPOWER_USER_ID=your-profile-id
export WINDSURF_EMAIL=your-email
export WINDSURF_PASSWORD=your-password
# 执行自动化
npm run run -- windsurf
```
---
## 🎯 就是这么简单!
你刚才做了什么:
1. ✅ 安装了TypeScript自动化框架
2. ✅ 使用了旧框架的YAML配置完全兼容
3. ✅ 运行了完整的Windsurf自动化流程
---
## 📖 添加新网站1分钟
### 1. 创建YAML配置
```bash
# 创建新网站配置
cat > configs/sites/mysite.yaml << EOF
site: mysite
workflow:
- action: navigate
url: https://mysite.com
- action: click
selector: "#login"
- action: fillForm
fields:
email: "{{account.email}}"
password: "{{account.password}}"
EOF
```
### 2. 设置账号信息
```bash
export MYSITE_EMAIL=your-email
export MYSITE_PASSWORD=your-password
```
### 3. 执行
```bash
npm run run -- mysite
```
---
## 💡 核心概念
### 通用执行器
- **1个工具运行所有网站**
- 只需编写YAML配置
- 不需要编写代码
### 工作流程
```
YAML配置 → 加载 → WorkflowEngine → AdsPower → 浏览器自动化
```
### 配置即代码
```yaml
workflow:
- action: navigate # 导航
- action: click # 点击
- action: fillForm # 填表
- action: verify # 验证
```
---
## 🔍 查看更多
- 📚 完整文档:`HOW-TO-USE.md`
- 🏗️ 架构说明:`docs/ARCHITECTURE.md`
- 📦 迁移进度:`MIGRATION-PROGRESS.md`
---
## ⚙️ 环境变量说明
### 必需
```bash
ADSPOWER_USER_ID=xxx # AdsPower配置ID
```
### 账号信息(按网站)
```bash
WINDSURF_EMAIL=xxx
WINDSURF_PASSWORD=xxx
STRIPE_EMAIL=xxx
STRIPE_PASSWORD=xxx
# 规则网站名_字段名大写
```
---
## 🎉 恭喜!
你已经掌握了新框架的使用方法!
现在可以:
- ✅ 复用旧框架的所有YAML配置
- ✅ 添加新网站只需创建YAML
- ✅ 享受TypeScript的类型安全
- ✅ 使用9个完整迁移的Action类
**开始自动化吧!** 🚀