office文件处理 image图片处理 zip文件处理 playwright自动化测试
- 2026-09-23 22:53:00
- admin
- 原创 391
一、docx文件处理
1、代码仓库:https://github.com/dolanmiu/docx
2、帮助文档:https://docx.js.org/#/?id=welcome
3、安装组件:npm install docx
二、xslx文件处理
exceljs:适合需要使用样式
1、代码仓库:https://github.com/exceljs/exceljs
2、组件特点:支持样式,流式处理,大文件内存友好,浏览器端可用;
3、安装组件:npm install exceljs
sheetjs:适合只需读写数据
1、代码仓库:https://github.com/SheetJS/sheetjs
2、帮助文档:https://docs.sheetjs.com/docs
3、组件特点:社区版不支持样式,解析快,但整体读入内存,兼容性更广;
4、安装组件:npm i --save https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
三、pptx文件处理
1、代码仓库:https://github.com/gitbrent/PptxGenJS
2、帮助文档:https://gitbrent.github.io/PptxGenJS
3、安装组件:npm install pptxgenjs
四、image-size图片大小
1、代码仓库:https://github.com/image-size/image-size
2、代码仓库:https://codeberg.org/image-size/image-size
3、安装组件:npm install image-size
五、sharp图片处理
1、代码仓库:https://github.com/lovell/sharp
2、帮助文档:https://sharp.pixelplumbing.com
3、安装组件:npm install sharp
六、zip文件处理
1、代码仓库:https://github.com/cthackers/adm-zip
2、安装组件:npm install adm-zip
七、playwright自动化测试
1、代码仓库:https://github.com/microsoft/playwright
2、帮助文档:https://playwright.dev/docs/intro
3、CLI帮助:https://playwright.dev/agent-cli/installation
4、MCP帮助:https://playwright.dev/mcp/introduction
5、浏览器位置:%LOCALAPPDATA%\ms-playwright
6、常用参数:-s=会话名,不同会话名使用不同浏览器;
7、常用参数:--browser=chrome,设置使用的浏览器;
安装组件:
1、自动化测试:npm init playwright@latest
2、安装cli:npm i -g @playwright/cli@latest
3、启动mcp:npx @playwright/mcp@latest
4、安装library:npm i playwright
常用命令:
1、playwright-cli install,初始化工作空间;
2、playwright-cli screenshot,浏览器截图;
3、playwright-cli list,显示所有浏览器会话;
4、playwright-cli show,显示所有浏览器实例;