social-agent-cli 2.2.0 → 2.2.1
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 +16 -23
- package/package.json +1 -1
package/ai/runner.ts
CHANGED
|
@@ -345,12 +345,25 @@ async function executeMapStep(
|
|
|
345
345
|
|
|
346
346
|
let uploaded = false;
|
|
347
347
|
|
|
348
|
-
// 1.
|
|
349
|
-
|
|
348
|
+
// 1. Sayfadaki TÜM input[type=file]'ları bul ve dosyayı set et
|
|
349
|
+
// Butona tıklamadan - file picker açılmasını önler
|
|
350
|
+
try {
|
|
351
|
+
const inputs = await page.locator('input[type="file"]').all();
|
|
352
|
+
for (const input of inputs) {
|
|
353
|
+
try {
|
|
354
|
+
await input.setInputFiles(filePath);
|
|
355
|
+
uploaded = true;
|
|
356
|
+
break;
|
|
357
|
+
} catch {}
|
|
358
|
+
}
|
|
359
|
+
} catch {}
|
|
360
|
+
|
|
361
|
+
// 2. input yoksa, fileChooser event ile butona tıkla
|
|
362
|
+
if (!uploaded && selectors.length > 0) {
|
|
350
363
|
for (const sel of selectors) {
|
|
351
364
|
try {
|
|
352
365
|
const [fileChooser] = await Promise.all([
|
|
353
|
-
page.waitForEvent("filechooser", { timeout:
|
|
366
|
+
page.waitForEvent("filechooser", { timeout: 3000 }),
|
|
354
367
|
page.click(sel),
|
|
355
368
|
]);
|
|
356
369
|
await fileChooser.setFiles(filePath);
|
|
@@ -360,26 +373,6 @@ async function executeMapStep(
|
|
|
360
373
|
}
|
|
361
374
|
}
|
|
362
375
|
|
|
363
|
-
// 2. Sayfadaki input[type=file]'a direkt set et
|
|
364
|
-
if (!uploaded) {
|
|
365
|
-
try {
|
|
366
|
-
const fileInput = page.locator('input[type="file"]').first();
|
|
367
|
-
await fileInput.waitFor({ timeout: 3000 });
|
|
368
|
-
await fileInput.setInputFiles(filePath);
|
|
369
|
-
uploaded = true;
|
|
370
|
-
} catch {}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// 3. Tüm input[type=file]'ları dene
|
|
374
|
-
if (!uploaded) {
|
|
375
|
-
try {
|
|
376
|
-
const inputs = await page.locator('input[type="file"]').all();
|
|
377
|
-
for (const input of inputs) {
|
|
378
|
-
try { await input.setInputFiles(filePath); uploaded = true; break; } catch {}
|
|
379
|
-
}
|
|
380
|
-
} catch {}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
376
|
if (!uploaded) throw new Error(`Upload failed: ${filePath}`);
|
|
384
377
|
if (step.waitMs) await page.waitForTimeout(step.waitMs);
|
|
385
378
|
break;
|