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

66 lines
1.2 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.

# Getting Started
## 安装依赖
```bash
cd browser-automation-ts
npm install
```
## 编译TypeScript
```bash
npm run build
```
## 运行测试
```bash
npm test
```
## 基本使用
```typescript
import { BrowserFactory, BrowserProviderType } from './src';
// 创建AdsPower Provider
const provider = BrowserFactory.create(BrowserProviderType.ADSPOWER, {
profileId: 'k1728p8l'
});
// 启动浏览器
const { browser, page } = await provider.launch();
// 使用浏览器
await page.goto('https://example.com');
// 关闭
await provider.close();
```
## 目录结构
```
src/
├── core/ # 核心抽象层
│ ├── interfaces/ # 接口定义(强制规范)
│ ├── base/ # 抽象基类(共享实现)
│ └── types/ # 类型定义
├── providers/ # Provider实现
│ └── adspower/ # AdsPower实现
│ ├── AdsPowerProvider.ts
│ ├── actions/ # AdsPower专用Actions
│ └── core/ # AdsPower专用Core
└── factory/ # 工厂类
```
## 下一步
1. 实现ActionsTODO
2. 实现WorkflowEngineTODO
3. 添加Playwright Provider
4. 完整测试