Browse Source

Retry Case Test

pull/254/head
naibo 9 months ago
parent
commit
30feb2ad8a
7 changed files with 209 additions and 21 deletions
  1. +9
    -7
      ElectronJS/src/taskGrid/FlowChart.html
  2. +9
    -7
      ElectronJS/src/taskGrid/FlowChart_CN.html
  3. +1
    -1
      ElectronJS/tasks/233.json
  4. +183
    -0
      ElectronJS/tasks/234.json
  5. +1
    -1
      ExecuteStage/.vscode/launch.json
  6. +0
    -1
      ExecuteStage/easyspider_executestage.py
  7. +6
    -4
      ExecuteStage/myChrome.py

+ 9
- 7
ElectronJS/src/taskGrid/FlowChart.html View File

@ -633,13 +633,15 @@ If the expression returns a value greater than 0 or evaluates to True, the opera
<input onkeydown="inputDelete(event)" class="form-control" v-model.number="list.nl[index.nowNodeIndex]['parameters']['waitElementIframeIndex']" type="number" required></input>
<label style="margin-top:5px">Maximum waiting time for element appearance (in seconds):</label>
<input onkeydown="inputDelete(event)" class="form-control" v-model.number="list.nl[index.nowNodeIndex]['parameters']['waitElementTime']" type="number" required></input>
<label style="margin-top:5px">Wait seconds <b>after</b> execution (can set decimal values, e.g., 0.5):</label>
<input onkeydown="inputDelete(event)" required type="number" class="form-control" v-model.number='list.nl[index.nowNodeIndex]["parameters"]["wait"]'></input>
<label>Wait Type</label>
<select v-model='list.nl[index.nowNodeIndex]["parameters"]["waitType"]' class="form-control">
<option value = 0>Fixed wait (set to wait for 10 seconds then it will wait for 10 seconds)</option>
<option value = 1>Random wait (set to wait for 10 seconds then it will randomly wait for 10 × 0.5 - 10 × 1.5 seconds)</option>
</select>
<div v-if="nodeType!=10">
<label style="margin-top:5px">Wait seconds <b>after</b> execution (can set decimal values, e.g., 0.5):</label>
<input onkeydown="inputDelete(event)" required type="number" class="form-control" v-model.number='list.nl[index.nowNodeIndex]["parameters"]["wait"]'></input>
<label>Wait Type</label>
<select v-model='list.nl[index.nowNodeIndex]["parameters"]["waitType"]' class="form-control">
<option value = 0>Fixed wait (set to wait for 10 seconds then it will wait for 10 seconds)</option>
<option value = 1>Random wait (set to wait for 10 seconds then it will randomly wait for 10 × 0.5 - 10 × 1.5 seconds)</option>
</select>
</div>
</div>
<!-- <button class="btn btn-outline-primary" style="margin-top: 20px;" id="confirm">Confirm</button>-->

+ 9
- 7
ElectronJS/src/taskGrid/FlowChart_CN.html View File

@ -633,13 +633,15 @@ print(emotlib.emoji()) # 使用其中的函数。
<input onkeydown="inputDelete(event)" class="form-control" v-model.number="list.nl[index.nowNodeIndex]['parameters']['waitElementIframeIndex']" type="number" required></input>
<label style="margin-top:5px">元素出现的最长等待时间(秒):</label>
<input onkeydown="inputDelete(event)" class="form-control" v-model.number="list.nl[index.nowNodeIndex]['parameters']['waitElementTime']" type="number" required></input>
<label style="margin-top:5px">操作<b>执行后</b>等待秒数(所有等待时间均可设置为小数,如0.5):</label>
<input onkeydown="inputDelete(event)" required type="number" class="form-control" v-model.number='list.nl[index.nowNodeIndex]["parameters"]["wait"]'></input>
<label style="margin-top:5px">等待类型</label>
<select v-model='list.nl[index.nowNodeIndex]["parameters"]["waitType"]' class="form-control">
<option value = 0>固定等待(设置等10秒就等10秒)</option>
<option value = 1>随机等待(设置等10秒会随机等10×0.5 - 10 × 1.5 秒)</option>
</select>
<div v-if="nodeType!=10">
<label style="margin-top:5px">操作<b>执行后</b>等待秒数(所有等待时间均可设置为小数,如0.5):</label>
<input onkeydown="inputDelete(event)" required type="number" class="form-control" v-model.number='list.nl[index.nowNodeIndex]["parameters"]["wait"]'></input>
<label style="margin-top:5px">等待类型</label>
<select v-model='list.nl[index.nowNodeIndex]["parameters"]["waitType"]' class="form-control">
<option value = 0>固定等待(设置等10秒就等10秒)</option>
<option value = 1>随机等待(设置等10秒会随机等10×0.5 - 10 × 1.5 秒)</option>
</select>
</div>
</div>
<!-- <button class="btn btn-outline-primary" style="margin-top: 20px;" id="confirm">确定</button>-->

+ 1
- 1
ElectronJS/tasks/233.json
File diff suppressed because it is too large
View File


+ 183
- 0
ElectronJS/tasks/234.json View File

@ -0,0 +1,183 @@
{
"id": 234,
"name": "京东全球版-专业的综合网上购物商城",
"url": "https://www.jd.com",
"links": "https://www.jd.com",
"create_time": "12/8/2023, 7:22:35 AM",
"update_time": "12/8/2023, 7:22:35 AM",
"version": "0.6.0",
"saveThreshold": 10,
"quitWaitTime": 60,
"environment": 0,
"maximizeWindow": 0,
"maxViewLength": 15,
"recordLog": 1,
"outputFormat": "xlsx",
"saveName": "current_time",
"inputExcel": "",
"startFromExit": 0,
"pauseKey": "p",
"containJudge": true,
"desc": "https://www.jd.com",
"inputParameters": [
{
"id": 0,
"name": "urlList_0",
"nodeId": 1,
"nodeName": "打开网页",
"value": "https://www.jd.com",
"desc": "要采集的网址列表,多行以\\n分开",
"type": "text",
"exampleValue": "https://www.jd.com"
}
],
"outputParameters": [],
"graph": [
{
"index": 0,
"id": 0,
"parentId": 0,
"type": -1,
"option": 0,
"title": "root",
"sequence": [1, 2],
"parameters": {
"history": 1,
"tabIndex": 0,
"useLoop": false,
"xpath": "",
"iframe": false,
"wait": 0,
"waitType": 0,
"beforeJS": "",
"beforeJSWaitTime": 0,
"afterJS": "",
"afterJSWaitTime": 0,
"waitElement": "",
"waitElementTime": 10,
"waitElementIframeIndex": 0
},
"isInLoop": false
},
{
"id": 1,
"index": 1,
"parentId": 0,
"type": 0,
"option": 1,
"title": "打开网页",
"sequence": [],
"isInLoop": false,
"position": 0,
"parameters": {
"useLoop": false,
"xpath": "",
"wait": 0,
"waitType": 0,
"beforeJS": "",
"beforeJSWaitTime": 0,
"afterJS": "",
"afterJSWaitTime": 0,
"waitElement": "",
"waitElementTime": 10,
"waitElementIframeIndex": 0,
"url": "https://www.jd.com",
"links": "https://www.jd.com",
"maxWaitTime": 10,
"scrollType": 0,
"scrollCount": 1,
"scrollWaitTime": 1,
"cookies": ""
}
},
{
"id": 2,
"index": 2,
"parentId": 0,
"type": 2,
"option": 9,
"title": "判断条件",
"sequence": [3, 4],
"isInLoop": false,
"position": 1,
"parameters": {
"history": 1,
"tabIndex": 0,
"useLoop": false,
"xpath": "",
"iframe": false,
"wait": 0,
"waitType": 0,
"beforeJS": "",
"beforeJSWaitTime": 0,
"afterJS": "",
"afterJSWaitTime": 0,
"waitElement": "",
"waitElementTime": 10,
"waitElementIframeIndex": 0
}
},
{
"id": 3,
"parentId": 2,
"index": 3,
"type": 3,
"option": 10,
"title": "条件分支1",
"sequence": [],
"isInLoop": false,
"parameters": {
"history": 1,
"tabIndex": 0,
"useLoop": false,
"xpath": "",
"iframe": false,
"wait": 0,
"waitType": 0,
"beforeJS": "",
"beforeJSWaitTime": 0,
"afterJS": "",
"afterJSWaitTime": 0,
"waitElement": "",
"waitElementTime": 10,
"waitElementIframeIndex": 0,
"class": 0,
"value": "",
"code": "",
"waitTime": 0
},
"position": 0
},
{
"id": 4,
"parentId": 2,
"index": 4,
"type": 3,
"option": 10,
"title": "条件分支2",
"sequence": [],
"isInLoop": false,
"parameters": {
"history": 1,
"tabIndex": 0,
"useLoop": false,
"xpath": "",
"iframe": false,
"wait": 0,
"waitType": 0,
"beforeJS": "",
"beforeJSWaitTime": 0,
"afterJS": "",
"afterJSWaitTime": 0,
"waitElement": "",
"waitElementTime": 10,
"waitElementIframeIndex": 0,
"class": 0,
"value": "",
"code": "",
"waitTime": 0
},
"position": 1
}
]
}

+ 1
- 1
ExecuteStage/.vscode/launch.json View File

@ -12,7 +12,7 @@
"justMyCode": false,
// "args": ["--ids", "[7]", "--read_type", "remote", "--headless", "0"]
// "args": ["--ids", "[9]", "--read_type", "remote", "--headless", "0", "--saved_file_name", "YOUTUBE"]
"args": ["--ids", "[29]", "--headless", "0", "--user_data", "1", "--keyboard", "0"]
"args": ["--ids", "[37]", "--headless", "0", "--user_data", "1", "--keyboard", "0"]
// "args": "--ids '[97]' --user_data 1 --server_address http://localhost:8074 --config_folder '/Users/naibo/Documents/EasySpider/ElectronJS/' --headless 0 --read_type remote --config_file_name config.json --saved_file_name"
}
]

+ 0
- 1
ExecuteStage/easyspider_executestage.py View File

@ -932,7 +932,6 @@ class BrowserThread(Thread):
if code > 0:
executeBranchId = i
break
# rt.end()
if executeBranchId != 0:
self.executeNode(executeBranchId, loopElement, clickPath, index)
else:

+ 6
- 4
ExecuteStage/myChrome.py View File

@ -94,10 +94,11 @@ class MyChrome(webdriver.Chrome):
if not frames:
raise NoSuchElementException(f"No iframes found in the current page while searching for {value}")
self.iframe_env = True
return self.find_element_recursive(by, value, frames)
element = self.find_element_recursive(by, value, frames)
else:
# Find element in the main document as normal
return super(MyChrome, self).find_element(by=by, value=value)
element = super(MyChrome, self).find_element(by=by, value=value)
return element
# def find_elements(self, by=By.ID, value=None, iframe=False):
# # 在这里改变查找元素的行为
@ -165,10 +166,11 @@ class MyChrome(webdriver.Chrome):
if not frames:
return [] # Return an empty list if no iframes are found
self.iframe_env = True
return self.find_elements_recursive(by, value, frames)
elements = self.find_elements_recursive(by, value, frames)
else:
# Find elements in the main document as normal
return super(MyChrome, self).find_elements(by=by, value=value)
elements = super(MyChrome, self).find_elements(by=by, value=value)
return elements
# MacOS不支持直接打包带Cloudflare的功能,如果要自己编译运行,可以把这个if去掉,然后配置好浏览器和driver路径
if sys.platform != "darwin":

Loading…
Cancel
Save