social-agent-cli 2.3.1 → 2.3.2
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/ai/runner.ts +14 -14
- package/package.json +1 -1
package/ai/runner.ts
CHANGED
|
@@ -178,25 +178,25 @@ async function executeStep(page: any, step: any, post: Post, params: Record<stri
|
|
|
178
178
|
// 1. input[type=file] direkt (file picker açmaz)
|
|
179
179
|
try {
|
|
180
180
|
const inputs = await page.locator('input[type="file"]').all();
|
|
181
|
-
for (const
|
|
182
|
-
try { await
|
|
181
|
+
for (const inp of inputs) {
|
|
182
|
+
try { await inp.setInputFiles(filePath); return; } catch {}
|
|
183
183
|
}
|
|
184
184
|
} catch {}
|
|
185
185
|
|
|
186
|
-
// 2. fileChooser ile butona tıkla
|
|
186
|
+
// 2. fileChooser event listener ile butona tıkla
|
|
187
187
|
for (const sel of selectors) {
|
|
188
|
+
let done = false;
|
|
189
|
+
const handler = async (fc: any) => { await fc.setFiles(filePath); done = true; };
|
|
190
|
+
page.on("filechooser", handler);
|
|
188
191
|
try {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
await fc.setFiles(filePath);
|
|
198
|
-
return;
|
|
199
|
-
} catch {}
|
|
192
|
+
await page.click(sel);
|
|
193
|
+
// fileChooser event'inin tetiklenmesini bekle
|
|
194
|
+
for (let w = 0; w < 20 && !done; w++) await page.waitForTimeout(250);
|
|
195
|
+
page.removeListener("filechooser", handler);
|
|
196
|
+
if (done) return;
|
|
197
|
+
} catch {
|
|
198
|
+
page.removeListener("filechooser", handler);
|
|
199
|
+
}
|
|
200
200
|
}
|
|
201
201
|
throw new Error(`Upload: ${filePath}`);
|
|
202
202
|
}
|