Change location of operation toolbox

This commit is contained in:
naibo 2023-12-15 16:32:26 +08:00
parent f21804f0e9
commit d13cd29fac
14 changed files with 1730 additions and 4440 deletions

View File

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -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"]);

View File

@ -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>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -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:

View File

@ -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">