autoclaw 1.0.29 → 1.0.30
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/dist/tools/screenshot.js +10 -2
- package/package.json +1 -1
package/dist/tools/screenshot.js
CHANGED
|
@@ -96,6 +96,10 @@ export const ScreenshotTool = {
|
|
|
96
96
|
fullPage: {
|
|
97
97
|
type: "boolean",
|
|
98
98
|
description: "If true (default), takes a screenshot of the full scrollable page. Set to false for viewport only."
|
|
99
|
+
},
|
|
100
|
+
waitTime: {
|
|
101
|
+
type: "number",
|
|
102
|
+
description: "Optional delay in seconds to wait for page resources to load before capturing (default: 1)."
|
|
99
103
|
}
|
|
100
104
|
},
|
|
101
105
|
required: ["url", "outputPath"]
|
|
@@ -155,8 +159,12 @@ export const ScreenshotTool = {
|
|
|
155
159
|
});
|
|
156
160
|
// Wait for fonts to be ready
|
|
157
161
|
await page.evaluate(() => document.fonts.ready);
|
|
158
|
-
// Additional
|
|
159
|
-
|
|
162
|
+
// Additional delay for dynamic content (user specified or default 1s)
|
|
163
|
+
const waitTimeMs = (args.waitTime || 1) * 1000;
|
|
164
|
+
if (waitTimeMs > 0) {
|
|
165
|
+
console.log(`Waiting for ${waitTimeMs}ms...`);
|
|
166
|
+
await page.waitForTimeout(waitTimeMs);
|
|
167
|
+
}
|
|
160
168
|
await page.screenshot({
|
|
161
169
|
path: args.outputPath,
|
|
162
170
|
fullPage: args.fullPage !== false // Default to true if undefined
|