Selaa lähdekoodia

Merge branch 'main' of https://github.com/automaapp/automa into dev

Ahmad Kholid 1 vuosi sitten
vanhempi
commit
76614a6182
1 muutettua tiedostoa jossa 7 lisäystä ja 3 poistoa
  1. 7 3
      src/content/blocksHandler/handlerTakeScreenshot.js

+ 7 - 3
src/content/blocksHandler/handlerTakeScreenshot.js

@@ -1,6 +1,6 @@
-/* eslint-disable no-await-in-loop */
-import { sendMessage } from '@/utils/message';
 import { sleep } from '@/utils/helper';
+import { sendMessage } from '@/utils/message';
+import handleSelector from '../handleSelector';
 
 function findScrollableElement(
   element = document.documentElement,
@@ -63,7 +63,11 @@ async function takeScreenshot(tabId, options) {
   return imageUrl;
 }
 async function captureElement({ selector, tabId, options, $frameRect }) {
-  const element = document.querySelector(selector);
+  const element = await handleSelector(
+    // ? not support frameSelector ?
+    { data: { selector }, tabId },
+    { returnElement: true }
+  );
 
   if (!element) {
     const error = new Error('element-not-found');