channel-worker 1.1.3 → 1.1.4
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/lib/command-poller.js +14 -2
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -650,10 +650,22 @@ class CommandPoller {
|
|
|
650
650
|
console.log(`[commands] File chooser: ${chooserResult}`);
|
|
651
651
|
|
|
652
652
|
if (chooserResult === 'opened') {
|
|
653
|
-
|
|
653
|
+
// File chooser intercepted — now set file via DOM.setFileInputFiles
|
|
654
|
+
// Find the file input that triggered the chooser
|
|
655
|
+
const doc = await send('DOM.getDocument');
|
|
656
|
+
const fileNode = await send('DOM.querySelector', { nodeId: doc.root.nodeId, selector: 'input[type="file"][accept*="image"]' });
|
|
657
|
+
if (!fileNode?.nodeId) {
|
|
658
|
+
// Fallback: any file input
|
|
659
|
+
const fallbackNode = await send('DOM.querySelector', { nodeId: doc.root.nodeId, selector: 'input[type="file"]' });
|
|
660
|
+
if (fallbackNode?.nodeId) {
|
|
661
|
+
await send('DOM.setFileInputFiles', { nodeId: fallbackNode.nodeId, files: [file_path] });
|
|
662
|
+
}
|
|
663
|
+
} else {
|
|
664
|
+
await send('DOM.setFileInputFiles', { nodeId: fileNode.nodeId, files: [file_path] });
|
|
665
|
+
}
|
|
654
666
|
await send('Page.setInterceptFileChooserDialog', { enabled: false });
|
|
655
667
|
ws.close();
|
|
656
|
-
resolve({ success: true, method: '
|
|
668
|
+
resolve({ success: true, method: 'file_chooser_intercepted' });
|
|
657
669
|
} else {
|
|
658
670
|
await send('Page.setInterceptFileChooserDialog', { enabled: false });
|
|
659
671
|
ws.close();
|