Преглед на файлове

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

Ahmad Kholid преди 1 година
родител
ревизия
76614a6182
променени са 1 файла, в които са добавени 7 реда и са изтрити 3 реда
  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 { sleep } from '@/utils/helper';
+import { sendMessage } from '@/utils/message';
+import handleSelector from '../handleSelector';
 
 
 function findScrollableElement(
 function findScrollableElement(
   element = document.documentElement,
   element = document.documentElement,
@@ -63,7 +63,11 @@ async function takeScreenshot(tabId, options) {
   return imageUrl;
   return imageUrl;
 }
 }
 async function captureElement({ selector, tabId, options, $frameRect }) {
 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) {
   if (!element) {
     const error = new Error('element-not-found');
     const error = new Error('element-not-found');