@iflyrpa/playwright v1.2.40
@iflyrpa/playwright
iflyrpa 封装的一组特定场景的自动化脚本,支持的场景如下:
平台 | 脚本 | 说明 | 支持的方式 |
---|---|---|---|
头条 | toutiaoPublish | 发布/保存草稿 | Mock Api / RPA |
头条 | getToutiaoConfig | 获取头条发布配置的话题信息、位置信息和原创首发信息 | Mock Api |
头条 | searchToutiaoTopicList | 搜索头条话题 | Mock Api |
微头条 | weitoutiaoPublish | 发布 | Mock Api / RPA |
百家号 | getBaijiahaoActivity | 查询百家号活动投稿 | Mock Api |
百家号 | baijiahaoPublish | 发布/保存草稿 | Mock Api / RPA |
微信公众号(小绿书-图文模式) | weixinmpPublish | 发布 | Mock Api / RPA |
微信公众号 | weixinPublish | 发布 | Mock Api |
小红书 | xiaohongshuPublish | 发布 | Mock Api / RPA |
小红书 | searchXiaohongshuLocation | 搜索小红书地址 | Mock Api |
安装
# npm
npm i @iflyrpa/playwright
# yarn
yarn add @iflyrpa/playwright
# pnpm
pnpm install @iflyrpa/playwright
使用方法
import { RpaTask } from "@iflyrpa/playwright";
// 1. 创建缓存目录
const cachePath = join(__dirname, "../main/cache");
// 2. 初始化
const automateTask = new RpaTask({
cachePath, // 缓存目录
debug: true, // debug 模式下可视化展示所有操作
forceUpdate: false, // 是否使用远程最新版本
user: { id: "xx", email: "xx@xx.com" }, // 用户信息
enverionment: "development", // 环境变量(主要用于在日志中区分环境)
});
// 3. 执行脚本,支持的脚本如上
automateTask.actions.xiaohongshuPublish(xiaohonshuPublishParams)
// 4. 应用关闭前,清除副作用
app.on("before-quit", (event) => {
if (!automateTask.isClosed) {
// 阻止应用立即退出
event.preventDefault();
automateTask.close().finally(() => {
console.log("close app");
app.quit();
});
}
});
注意事项
1. 缓存目录包含以下文件:
- packages:运行时依赖和脚本缓存目录
- tmp:运行时缓存目录
- rpa.log:运行日志文件
2. 如何获取脚本入参类型:
import type { ActionMethodParams } from "@iflyrpa/playwright";
export const xiaohonshuPublishParams: ActionMethodParams['xiaohongshuPublish'] = {}
automateTask.actions.xiaohongshuPublish(xiaohonshuPublishParams)
8 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
4 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
10 months ago
10 months ago
7 months ago
7 months ago
10 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
6 months ago
6 months ago
7 months ago
6 months ago
5 months ago
6 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
6 months ago
6 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
4 months ago
5 months ago
5 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago