@skrillex1224/playwright-toolkit 2.1.221 → 2.1.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +196 -54
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +196 -54
- package/dist/index.js.map +4 -4
- package/index.d.ts +37 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -210,6 +210,7 @@ const cookies = Utils.parseCookies('key=value; key2=value2', '.example.com');
|
|
|
210
210
|
await page.context().addCookies(cookies);
|
|
211
211
|
|
|
212
212
|
// 全页面滚动截图 (自动检测所有滚动元素,强制展开后截图,默认会执行 watermarkify)
|
|
213
|
+
// 默认会将返回的 base64 压缩到 8MiB 以内,避免 Apify/Crawlee dataset 单条 item 超限
|
|
213
214
|
const base64Image = await Share.captureScreen(page);
|
|
214
215
|
|
|
215
216
|
// 移动端宽度截图(moblie 拼写保持兼容)
|
|
@@ -249,7 +250,14 @@ const image4 = await Share.captureScreen(page, {
|
|
|
249
250
|
const image5 = await Share.captureScreen(page, {
|
|
250
251
|
watermarkify: false,
|
|
251
252
|
});
|
|
252
|
-
//
|
|
253
|
+
// 指定更小的返回体积。内部使用 Jimp 重编码:优先降 JPEG 质量,仍超限时再等比缩放。
|
|
254
|
+
const image6 = await Share.captureScreen(page, {
|
|
255
|
+
maxBytes: 4 * 1024 * 1024,
|
|
256
|
+
quality: 60,
|
|
257
|
+
minQuality: 35,
|
|
258
|
+
outputType: 'jpeg',
|
|
259
|
+
});
|
|
260
|
+
// 返回 base64 编码图片,默认输出会在超限时转为 JPEG 压缩
|
|
253
261
|
```
|
|
254
262
|
|
|
255
263
|
---
|