Explorar o código

Change location of operation toolbox

naibo hai 1 ano
pai
achega
d13cd29fac

+ 17 - 5
.temp_to_pub/EasySpider_windows_x64/Code/easyspider_executestage.py

@@ -335,7 +335,10 @@ class BrowserThread(Thread):
                 node["parameters"]["quickExtractable"] = False # 是否可以快速提取
                 # 如果(不)固定元素列表循环中只有一个提取数据操作,且提取数据操作的提取内容为元素截图,那么可以快速提取
                 if len(node["sequence"]) == 1 and self.procedure[node["sequence"][0]]["option"] == 3 and (int(node["parameters"]["loopType"]) == 1 or int(node["parameters"]["loopType"]) == 2):
-                    params = self.procedure[node["sequence"][0]]["parameters"]["params"]
+                    try:
+                        params = self.procedure[node["sequence"][0]]["parameters"]["params"]
+                    except:
+                        params = self.procedure[node["sequence"][0]]["parameters"]["paras"] # 兼容0.5.0及以下版本的EasySpider
                     try:
                         waitElement = self.procedure[node["sequence"][0]]["parameters"]["waitElement"]
                     except:
@@ -1031,7 +1034,8 @@ class BrowserThread(Thread):
         ti = 0
         # print("CURRENT URL:", self.browser.current_url)
         # time.sleep(2)
-        if self.browser.current_url.startswith("data:") or self.browser.current_url.startswith("chrome:"):
+        # if self.browser.current_url.startswith("data:") or self.browser.current_url.startswith("chrome:"):
+        if self.browser.current_url != thisHistoryURL and self.history["index"] != thisHistoryLength and self.history["handle"] == self.browser.current_window_handle:
             while self.browser.current_url != thisHistoryURL:  # 如果执行完一次循环之后网址发生了变化
                 try:
                     self.browser.execute_script("history.go(1)")  # 如果是data:开头的网址,就前进一步
@@ -1045,8 +1049,8 @@ class BrowserThread(Thread):
                 element = self.browser.find_elements(By.XPATH, xpath, iframe=node["parameters"]["iframe"])
             else: # 固定元素列表
                 element = self.browser.find_element(By.XPATH, xpath, iframe=node["parameters"]["iframe"])
-            if index > 0:
-                index -= 1  # 如果是data:开头的网址,就要重试一次
+            # if index > 0:
+                # index -= 1  # 如果是data:开头的网址,就要重试一次
         else:
             if element == None:
                 element = elements
@@ -1199,8 +1203,16 @@ class BrowserThread(Thread):
                     self.print_and_log("找不到循环元素: ", xpath)
                 index = 0
                 while index < len(elements):
+                    try:
+                        element = elements[index]
+                        element_text = element.text
+                    except StaleElementReferenceException: # 如果元素已经失效,重试
+                        self.print_and_log("元素已失效,重新获取元素|Element has expired, reacquiring element")
+                        elements = self.browser.find_elements(By.XPATH,
+                                                              xpath, iframe=node["parameters"]["iframe"])
+                        element = elements[index]
                     for i in node["sequence"]:  # 挨个顺序执行循环里所有的操作
-                        self.executeNode(i, elements[index],
+                        self.executeNode(i, element,
                                          xpath, index)
                         if self.BREAK or self.CONTINUE:  # 如果有break操作,下面的操作不执行
                             self.CONTINUE = False

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 329 - 377
.temp_to_pub/EasySpider_windows_x64/tasks/115.json


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/tasks/205.json


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/tasks/293.json


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/tasks/294.json


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
.temp_to_pub/EasySpider_windows_x64/tasks/295.json


BIN=BIN
ElectronJS/EasySpider_en.crx


BIN=BIN
ElectronJS/EasySpider_zh.crx


+ 4 - 0
ElectronJS/src/taskGrid/logic.js

@@ -633,6 +633,10 @@ if (sId != null && sId != -1) //加载任务
                 if (!("cookies" in node["parameters"])) {
                     node["parameters"]["cookies"] = "";
                 }
+            } else if(node["option"] == 3){ //提取数据
+                if(node["parameters"]["paras"] != undefined){
+                    node["parameters"]["params"] = node["parameters"]["paras"];
+                }
             }
         }
         $("#serviceName").val(result["name"]);

+ 1 - 1
ElectronJS/src/taskGrid/taskInfo.html

@@ -51,7 +51,7 @@
             <p style="word-wrap: break-word;word-break: break-all;overflow: hidden;max-height: 100px;">{{"Update Time:~更新时间:" | lang}} {{dateFormat(task["update_time"])}}</p>
             <p>{{"Operations (Please close this window and select 'Design Task' button if you want to modify task with a browser)~操作(如要带浏览器修改任务流程请关闭此窗口并选择设计任务)" | lang}}</p>
             <p><a style="margin-top: 5px" href="javascript:void(0)" v-on:click="modifyTask(task['id'],task['url'])" class="btn btn-primary">{{"Modify Task Workflow~修改任务流程" | lang}}</a>
-                <a style="margin-top: 5px" href="javascript:void(0)" v-on:click="invokeTask(task['id'],task['url'])" class="btn btn-primary">{{"Invoke & execute Task~执行任务" | lang}}</a></p>
+                <a style="margin-top: 5px" href="javascript:void(0)" v-on:click="invokeTask(task['id'],task['url'])" class="btn btn-primary">{{"Execute Task~执行任务" | lang}}</a></p>
             <p>{{"Input Parameters~输入参数" | lang}}</p>
             <table class="table table-bordered">
                 <tbody>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 329 - 377
ElectronJS/tasks/115.json


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
ElectronJS/tasks/205.json


+ 4 - 1
ExecuteStage/easyspider_executestage.py

@@ -335,7 +335,10 @@ class BrowserThread(Thread):
                 node["parameters"]["quickExtractable"] = False # 是否可以快速提取
                 # 如果(不)固定元素列表循环中只有一个提取数据操作,且提取数据操作的提取内容为元素截图,那么可以快速提取
                 if len(node["sequence"]) == 1 and self.procedure[node["sequence"][0]]["option"] == 3 and (int(node["parameters"]["loopType"]) == 1 or int(node["parameters"]["loopType"]) == 2):
-                    params = self.procedure[node["sequence"][0]]["parameters"]["params"]
+                    try:
+                        params = self.procedure[node["sequence"][0]]["parameters"]["params"]
+                    except:
+                        params = self.procedure[node["sequence"][0]]["parameters"]["paras"] # 兼容0.5.0及以下版本的EasySpider
                     try:
                         waitElement = self.procedure[node["sequence"][0]]["parameters"]["waitElement"]
                     except:

+ 5 - 5
Extension/manifest_v3/src/content-scripts/toolkit.vue

@@ -25,8 +25,6 @@
             <p style="color:black; margin-top: 10px">●
               鼠标移动到元素上后,请<strong>右键</strong>点击或者按<strong>F7</strong>键选中页面元素。
             </p>
-            <p style="color:black; margin-top: 10px">●
-              如果此操作台把页面元素挡住了,可以点击此操作台右下角的×按钮键关闭操作台。</p>
             <p style="color:black; margin-top: 10px">●
               通过鼠标左键进行点击时,页面也会有反应,但左键点击发生的操作不会被记录在任务流程中;同理,如果想输入文本框但并不想将动作记录,可以鼠标移动到文本框,并按键盘的<strong>F9</strong>进行输入。
             </p>
@@ -34,6 +32,8 @@
               如果不小心左键点选了元素导致页面跳转,直接后退或者切换回标签页即可。</p>
             <p style="color:black; margin-top: 10px">● 操作完成后,如点击”确认采集“后任务流程图内没有”提取数据“操作被添加,<strong>重试一次</strong>即可。
             </p>
+            <p style="color:black; margin-top: 10px">●
+              如果此操作台把页面元素挡住了,可以点击此操作台右下角的×按钮键关闭操作台。</p>
             {{ initial() }}
           </div>
           <div v-if="list.nl.length==1">
@@ -231,9 +231,6 @@
             <p style="color:black; margin-top: 10px">● When your mouse moves to the element, please
               <strong>right-click</strong> your
               mouse button or press <strong>F7</strong> on the keyboard to select it.</p>
-            <p style="color:black; margin-top: 10px">● If this toolbox blocks the page element, you can click the ×
-              button in the
-              lower right corner of this toolbox to close it.</p>
             <p style="color:black; margin-top: 10px">● When clicked with the left mouse button, the page will also
               respond, but this click operation will not be recorded in the task flow. Similarly, if you want to input
               in a text box but do not want the action to be recorded , you can move the mouse to the text box and
@@ -244,6 +241,9 @@
             <p style="color:black; margin-top: 10px">● After the operation is completed, such as if no "Collect Data"
               operation is added in the task flowchart after clicking "Confirm Collect", just <strong> retry </strong>
               again.</p>
+            <p style="color:black; margin-top: 10px">● If this toolbox blocks the page element, you can click the ×
+              button in the
+              lower right corner of this toolbox to close it.</p>
             {{ initial() }}
           </div>
           <div v-if="list.nl.length==1">

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio