mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-12 11:37:11 +08:00
增加最终XPath提示
This commit is contained in:
parent
c8d6017190
commit
0f5c6a89bf
@ -2,7 +2,7 @@ Official Site: https://www.easyspider.net
|
||||
|
||||
Welcome to promote this software to other friends.
|
||||
|
||||
This version is for Windows 7 and above, including both 32-bit and 64-bit version. Please note that this version of the Chrome browser will always remain at version 109 and will not update with Chrome updates (for compatibility with Windows 7). Therefore, if you want to use the latest version of the Chrome browser for data scraping, please run the x64 version of EasySpider on Windows 10 x64 or higher systems.
|
||||
This version is for Windows 7 and above, including both 32-bit and 64-bit version. Please note that this version of the Chrome browser will always remain at version 109 and will not update with Chrome updates (for compatibility with Windows 7). Therefore, if you want to use the latest version of the Chrome browser for data scraping, please run the x64 version of EasySpider on Windows 10 x64 or higher systems. There is no version support for Windows Server 2012 and below. These systems require manual compilation for execution.
|
||||
|
||||
Video Tutorial: https://youtube.com/playlist?list=PL0kEFEkWrT7mt9MUlEBV2DTo1QsaanUTp
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
官方网址: https://www.easyspider.cn
|
||||
|
||||
支持Windows 7及以上版本,包括32位系统和64位系统。注意此版本的Chrome浏览器永远都是109,不会随着Chrome更新而更新(为了兼容Win 7系统),因此如果想用最新版Chrome浏览器采集数据,请在Windows 10 x64及以上系统上运行x64版本的EasySpider。
|
||||
支持Windows 7及以上版本,包括32位系统和64位系统。注意此版本的Chrome浏览器永远都是109,不会随着Chrome更新而更新(为了兼容Win 7系统),因此如果想用最新版Chrome浏览器采集数据,请在Windows 10 x64及以上系统上运行x64版本的EasySpider。无任何版本支持Windows Server 2012及以下版本系统,这些系统下需要自行编译运行。
|
||||
|
||||
视频教程:https://www.bilibili.com/video/BV1th411A7ey/
|
||||
|
||||
|
@ -2,9 +2,9 @@ Official Site: https://www.easyspider.net
|
||||
|
||||
Welcome to promote this software to other friends.
|
||||
|
||||
This version is for Windows 10 x64 and above.
|
||||
This version is for Windows 10/Windows Server 2016 x64 and above.
|
||||
|
||||
The Windows version supports **Windows 10 and above**. If you want to use EasySpider on windows 7, please download the Windows x32 version of EasySpider.
|
||||
The Windows version supports **Windows 10 and above**. If you want to use EasySpider on windows 7, please download the Windows x32 version of EasySpider. There is no version support for Windows Server 2012 and below. These systems require manual compilation for execution.
|
||||
|
||||
Video Tutorial: https://youtube.com/playlist?list=PL0kEFEkWrT7mt9MUlEBV2DTo1QsaanUTp
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,9 +2,9 @@
|
||||
|
||||
官方网址: https://www.easyspider.cn
|
||||
|
||||
支持Windows 10 x64及以上版本。
|
||||
支持Windows 10/Windows Server 2016 x64及以上版本。
|
||||
|
||||
Windows 7任意版本,包括x64和x32版本,以及Windows 10 x32版本请下载Windows的32位版本使用。
|
||||
Windows 7任意版本,包括x64和x32版本,以及Windows 10 x32版本请下载Windows的32位版本使用。无任何版本支持Windows Server 2012及以下版本系统,这些系统下需要自行编译运行。
|
||||
|
||||
视频教程:https://www.bilibili.com/video/BV1th411A7ey/
|
||||
|
||||
|
@ -145,8 +145,28 @@
|
||||
</div>
|
||||
<div>
|
||||
<label>XPath (Or use "point(10,10)" to represent clicking on the web page at coordinate position (10, 10), suitable for the situation when need to click on a blank area to leave popup dialog): <span style="font-size: 30px!important;" title="Relative XPATH writing: start with /, e.g. the loop item XPATH is /html/body/div[1], your input is /*[@id='tab-customer'], then the final addressed xpath is: /html/body/div[1]/*[@id='tab-customer']">☺</span></label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='nowNode["parameters"]["xpath"]'></textarea>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='xpath'></textarea>
|
||||
<p><button type="button" data-toggle="modal" data-target="#myModal_XPath" @click="changeXPaths(nowNode['parameters']['allXPaths'])" class="btn btn-primary" style="margin-top: 10px">Click here to view other equivalent XPath expressions</button></p>
|
||||
<label>The final XPath of this element when the task is running:</label>
|
||||
<textarea v-model="getFinalXPath(nowNode['parameters']['xpath'], useLoop)" spellcheck="false" onkeydown="inputDelete(event)" class="form-control" rows="2" readonly style="background:ghostwhite"></textarea>
|
||||
</div>
|
||||
<p style="margin-top: 10px">
|
||||
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||
Click here to expand/collapse advanced operations
|
||||
</a>
|
||||
</p>
|
||||
<div :class="{collapse: true, 'show': nowNode['parameters']['beforeJS'].length!=0 || nowNode['parameters']['afterJS'].length!=0}" id="collapseExample">
|
||||
<div>
|
||||
<label>Execute a JavaScript script <strong>before</strong> clicking on this element:</label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2"
|
||||
placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].innerText = arguments[0].innerText.replace("United States","US"). This code replaces occurrences of "United States" with "US" in the text of the element. Subsequently, when extracting data, you will obtain the replaced value.' v-model='nowNode["parameters"]["beforeJS"]'></textarea>
|
||||
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='nowNode["parameters"]["beforeJSWaitTime"]'></input>
|
||||
<label>Execute a JavaScript script <strong>after</strong> clicking on this element: </label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].click(). This code simulates a click on the element.' v-model='nowNode["parameters"]["afterJS"]'></textarea>
|
||||
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='nowNode["parameters"]["afterJSWaitTime"]'></input>
|
||||
</div>
|
||||
</div>
|
||||
<label>Maximum wait time for page load after clicking (in seconds):</label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" class="form-control" v-model.number="nowNode['parameters']['maxWaitTime']" type="number" required></input>
|
||||
@ -177,24 +197,6 @@
|
||||
<option :value = 1>Accept pop-up window</option>
|
||||
<option :value = 2>Reject pop-up window (only for Confirm pop-up window)</option>
|
||||
</select></p>
|
||||
<p style="margin-top: 10px">
|
||||
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||
Click here to expand/collapse advanced operations
|
||||
</a>
|
||||
</p>
|
||||
<div :class="{collapse: true, 'show': nowNode['parameters']['beforeJS'].length!=0 || nowNode['parameters']['afterJS'].length!=0}" id="collapseExample">
|
||||
<div>
|
||||
<label>Execute a JavaScript script <strong>before</strong> clicking on this element:</label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2"
|
||||
placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].innerText = arguments[0].innerText.replace("United States","US"). This code replaces occurrences of "United States" with "US" in the text of the element. Subsequently, when extracting data, you will obtain the replaced value.' v-model='nowNode["parameters"]["beforeJS"]'></textarea>
|
||||
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='nowNode["parameters"]["beforeJSWaitTime"]'></input>
|
||||
<label>Execute a JavaScript script <strong>after</strong> clicking on this element: </label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" placeholder='The element should be represented by arguments[0]. Here is an example JavaScript code: arguments[0].click(). This code simulates a click on the element.' v-model='nowNode["parameters"]["afterJS"]'></textarea>
|
||||
<label>Maximum wait time for script execution (0 represents unlimited wait time): </label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='nowNode["parameters"]["afterJSWaitTime"]'></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -237,6 +239,8 @@
|
||||
<p>XPATH (Field["FieldName"] and eval("your code") can be used in any XPATHS): <span style="font-size: 30px!important;" title="Relative XPATH writing: start with /, e.g. the loop item XPATH is /html/body/div[1], your input is /*[@id='tab-customer'], then the final addressed xpath is: /html/body/div[1]/*[@id='tab-customer']">☺</span></p>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='params.parameters[paraIndex]["relativeXPath"]' placeholder="If you want to write the XPath relative to the current element in the loop, you can write as *../div[1] which matches the first div child element of the parent of the current element in the loop."></textarea>
|
||||
<p><button type="button" data-toggle="modal" data-target="#myModal_XPath" @click="changeXPaths(params.parameters[paraIndex]['allXPaths'])" class="btn btn-primary" style="margin-top: 10px">Click here to view other equivalent XPath expressions</button></p>
|
||||
<label>Final XPath of this field when the task is running:</label>
|
||||
<textarea spellcheck="false" onkeydown="inputDelete(event)" class="form-control" rows="2" readonly style="background:ghostwhite">{{getFinalXPath(params.parameters[paraIndex]['relativeXPath'], params.parameters[paraIndex]['relative'])}}</textarea>
|
||||
<p style="margin-top: 10px">
|
||||
<a class="btn btn-primary" data-toggle="collapse" href="#elementAdvanced" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||
Click here to expand/collapse advanced operations
|
||||
@ -256,21 +260,6 @@
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='params.parameters[paraIndex]["afterJSWaitTime"]'></input>
|
||||
</div>
|
||||
</div>
|
||||
<label>Parameter type conversion (for Excel and Database):</label>
|
||||
<select v-model='params.parameters[paraIndex]["paraType"]' class="form-control">
|
||||
<option value = "text">Text (for single values estimated to exceed 10,000 in length, please choose Large Text)</option>
|
||||
<option value = "int">Integer (up to 9 digits)</option>
|
||||
<option value = "double">Floating Number (Decimal)</option>
|
||||
<option value = "mediumText">Large Text (single value length exceeding 10,000 but less than 1,000,000)</option>
|
||||
<option value = "datetime">Date Time</option>
|
||||
<option value = "date">Date</option>
|
||||
<option value = "time">Time</option>
|
||||
<option value = "varchar">Small Text (single value length less than 50)</option>
|
||||
<option value = "longText">Extra Large Text (single value length exceeding 1,000,000)</option>
|
||||
<option value = "bigInt">Large Integer (more than 9 digits)</option>
|
||||
</select>
|
||||
<label>Default value when cannot find this element:</label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" class="form-control" v-model='params.parameters[paraIndex]["default"]'></textarea>
|
||||
<label>Extract Type</label>
|
||||
<select v-model='params.parameters[paraIndex]["contentType"]' class="form-control">
|
||||
<option :value = 0>Text (include child element)</option>
|
||||
@ -320,6 +309,21 @@
|
||||
<!-- <option :value = 0>普通提取</option>-->
|
||||
<!-- <option :value = 1>OCR提取</option>-->
|
||||
<!-- </select>-->
|
||||
<label>Parameter type conversion (for Excel and Database):</label>
|
||||
<select v-model='params.parameters[paraIndex]["paraType"]' class="form-control">
|
||||
<option value = "text">Text (for single values estimated to exceed 10,000 in length, please choose Large Text)</option>
|
||||
<option value = "int">Integer (up to 9 digits)</option>
|
||||
<option value = "double">Floating Number (Decimal)</option>
|
||||
<option value = "mediumText">Large Text (single value length exceeding 10,000 but less than 1,000,000)</option>
|
||||
<option value = "datetime">Date Time</option>
|
||||
<option value = "date">Date</option>
|
||||
<option value = "time">Time</option>
|
||||
<option value = "varchar">Small Text (single value length less than 50)</option>
|
||||
<option value = "longText">Extra Large Text (single value length exceeding 1,000,000)</option>
|
||||
<option value = "bigInt">Large Integer (more than 9 digits)</option>
|
||||
</select>
|
||||
<label>Default value when cannot find this element:</label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" class="form-control" v-model='params.parameters[paraIndex]["default"]'></textarea>
|
||||
<label style="margin-top: 15px">Wrap content to new line (set when collecting long articles and wanting to wrap):</label>
|
||||
<select v-model='params.parameters[paraIndex]["splitLine"]' class="form-control">
|
||||
<option :value="0">No</option>
|
||||
@ -519,6 +523,8 @@ Please note that this feature does not support assigning values to variables. In
|
||||
<label>XPath: </label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='nowNode["parameters"]["xpath"]'></textarea>
|
||||
<p><button type="button" data-toggle="modal" data-target="#myModal_XPath" @click="changeXPaths(nowNode['parameters']['allXPaths'])" class="btn btn-primary" style="margin-top: 10px">Click here to view other equivalent XPath expressions</button></p>
|
||||
<label>The final XPath of this element when the task is running:</label>
|
||||
<textarea v-model="getFinalXPath(nowNode['parameters']['xpath'], useLoop)" spellcheck="false" onkeydown="inputDelete(event)" class="form-control" rows="2" readonly style="background:ghostwhite"></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -46,6 +46,7 @@ let app = new Vue({
|
||||
index: vueData,
|
||||
nodeType: 0, // 当前元素的类型
|
||||
nowNode: null, // 用来临时存储元素的节点
|
||||
parentNode: null, // 用来临时存储元素的父节点
|
||||
codeMode: -1, //代码模式
|
||||
loopType: -1, //点击循环时候用来循环选项
|
||||
useLoop: false, //记录是否使用循环内元素
|
||||
@ -53,6 +54,7 @@ let app = new Vue({
|
||||
params: {"parameters": []}, //提取数据的参数列表
|
||||
TClass: -1, //条件分支的条件类别
|
||||
paraIndex: 0, //当前参数的index
|
||||
xpath: "", //当前操作的xpath
|
||||
XPaths: "", //xpath列表
|
||||
},
|
||||
mounted: function () {
|
||||
@ -62,6 +64,12 @@ let app = new Vue({
|
||||
// console.log("scroll")
|
||||
// }, 500);
|
||||
},
|
||||
// computed: {
|
||||
// finalXPath: function () {
|
||||
// console.log("Call finalXPath")
|
||||
// return this.getFinalXPath(this.nowNode["parameters"]["xpath"], this.nowNode["parameters"]["useLoop"]);
|
||||
// }
|
||||
// },
|
||||
watch: {
|
||||
nowArrow: { //变量发生变化的时候进行一些操作
|
||||
deep: true,
|
||||
@ -91,6 +99,11 @@ let app = new Vue({
|
||||
updateUI();
|
||||
}
|
||||
},
|
||||
'nowNode.parameters.xpath': { //xpath发生变化的时候更新参数值
|
||||
handler: function (newVal, oldVal) {
|
||||
console.log("xpath changed", newVal, oldVal);
|
||||
}
|
||||
},
|
||||
loopType: { //循环类型发生变化的时候更新参数值
|
||||
handler: function (newVal, oldVal) {
|
||||
// this.nowNode["parameters"]["loopType"] = newVal;
|
||||
@ -106,6 +119,11 @@ let app = new Vue({
|
||||
this.nowNode["parameters"]["useLoop"] = newVal;
|
||||
}
|
||||
},
|
||||
xpath: {
|
||||
handler: function (newVal, oldVal) {
|
||||
this.nowNode["parameters"]["xpath"] = newVal;
|
||||
}
|
||||
},
|
||||
params: {
|
||||
handler: function (newVal, oldVal) {
|
||||
this.nowNode["parameters"]["params"] = newVal["parameters"];
|
||||
@ -123,6 +141,26 @@ let app = new Vue({
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getFinalXPath: function (xpath, useLoop) { //获取最终的xpath
|
||||
// console.log(xpath, useLoop, this.parentNode);
|
||||
if(this.parentNode == null || this.parentNode.parameters == null || this.parentNode.parameters.xpath == null){
|
||||
return xpath;
|
||||
} else if (useLoop) {
|
||||
let parent_xpath = this.parentNode.parameters.xpath;
|
||||
let final_xpath = "";
|
||||
final_xpath = parent_xpath + xpath;
|
||||
if (this.parentNode.parameters.loopType == 2) {
|
||||
parent_xpath = this.parentNode.parameters.pathList.split("\n");
|
||||
final_xpath = "";
|
||||
for (let i = 0; i < parent_xpath.length; i++) {
|
||||
final_xpath += parent_xpath[i] + xpath + "\n";
|
||||
}
|
||||
}
|
||||
return final_xpath;
|
||||
} else {
|
||||
return xpath;
|
||||
}
|
||||
},
|
||||
handleCodeModeChange: function () {
|
||||
// if (this.codeMode == undefined || this.codeMode == null || this.codeMode == -1) {
|
||||
// return;
|
||||
@ -433,7 +471,7 @@ function operationChange(e, theNode) {
|
||||
if (nowNode != null) {
|
||||
nowNode.style.borderColor = "skyblue";
|
||||
}
|
||||
nowNode = theNode
|
||||
nowNode = theNode;
|
||||
vueData.nowNodeIndex = actionSequence[theNode.getAttribute("data")];
|
||||
theNode.style.borderColor = "blue";
|
||||
handleElement(); //处理元素
|
||||
@ -676,13 +714,13 @@ function toolBoxKernel(e, param = null) {
|
||||
} else {
|
||||
$("#" + t["id"]).click();
|
||||
}
|
||||
|
||||
if (e != null)
|
||||
if (e != null){
|
||||
e.stopPropagation(); //防止冒泡
|
||||
}
|
||||
option = 0;
|
||||
return t;
|
||||
}
|
||||
option = 0;
|
||||
updateParentNode();
|
||||
}
|
||||
|
||||
$(".options").mousedown(function () {
|
||||
|
@ -145,8 +145,28 @@
|
||||
</div>
|
||||
<div>
|
||||
<label>XPath(或者用point(10,10)表示点击网页坐标位置(10, 10)以用来点击空白区域推出弹窗对话框文本列表等): <span style="font-size: 30px!important;" title="相对XPATH写法:以/开头,如循环项XPATH为/html/body/div[1],您的输入为/*[@id='tab-customer'],则最终寻址的xpath为:/html/body/div[1]/*[@id='tab-customer']">☺</span></label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='nowNode["parameters"]["xpath"]'></textarea>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='xpath'></textarea>
|
||||
<p><button type="button" data-toggle="modal" data-target="#myModal_XPath" @click="changeXPaths(nowNode['parameters']['allXPaths'])" class="btn btn-primary" style="margin-top: 10px">点此查看其他等价的XPath</button></p>
|
||||
<label>任务运行时最终定位的本元素XPath:</label>
|
||||
<textarea v-model="getFinalXPath(nowNode['parameters']['xpath'], useLoop)" spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" readonly style="background:ghostwhite"></textarea>
|
||||
</div>
|
||||
<p style="margin-top: 10px">
|
||||
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||
点此展开/折叠自定义操作
|
||||
</a>
|
||||
</p>
|
||||
<div :class="{collapse: true, 'show': nowNode['parameters']['beforeJS'].length!=0 || nowNode['parameters']['afterJS'].length!=0}" id="collapseExample">
|
||||
<div>
|
||||
<label>点击该元素<strong>前</strong>针对该元素执行一段JavaScript脚本: </label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2"
|
||||
placeholder='该元素用arguments[0]来表示,示例JS代码:arguments[0].innerText = arguments[0].innerText.replace("上海","Shanghai")即实现了将元素文字中的“上海”替换成”Shanghai“的功能,然后后续如提取数据时就会提取到替换后的值。' v-model='nowNode["parameters"]["beforeJS"]'></textarea>
|
||||
<label>最长等待脚本执行时间(0代表无限等待): </label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='nowNode["parameters"]["beforeJSWaitTime"]'></input>
|
||||
<label>点击该元素<strong>后</strong>针对该元素执行一段JavaScript脚本: </label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" placeholder='该元素用arguments[0]来表示,示例JS代码:arguments[0].click()即点击此元素' v-model='nowNode["parameters"]["afterJS"]'></textarea>
|
||||
<label>最长等待脚本执行时间(0代表无限等待): </label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='nowNode["parameters"]["afterJSWaitTime"]'></input>
|
||||
</div>
|
||||
</div>
|
||||
<label>点击后页面加载最长等待时间(秒):</label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" class="form-control" v-model.number="nowNode['parameters']['maxWaitTime']" type="number" required></input>
|
||||
@ -177,24 +197,6 @@
|
||||
<option :value = 1>接受弹窗(点击弹窗确定按钮)</option>
|
||||
<option :value = 2>拒绝弹窗(点击弹窗取消按钮,仅限Confirm弹框)</option>
|
||||
</select></p>
|
||||
<p style="margin-top: 10px">
|
||||
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||
点此展开/折叠自定义操作
|
||||
</a>
|
||||
</p>
|
||||
<div :class="{collapse: true, 'show': nowNode['parameters']['beforeJS'].length!=0 || nowNode['parameters']['afterJS'].length!=0}" id="collapseExample">
|
||||
<div>
|
||||
<label>点击该元素<strong>前</strong>针对该元素执行一段JavaScript脚本: </label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2"
|
||||
placeholder='该元素用arguments[0]来表示,示例JS代码:arguments[0].innerText = arguments[0].innerText.replace("上海","Shanghai")即实现了将元素文字中的“上海”替换成”Shanghai“的功能,然后后续如提取数据时就会提取到替换后的值。' v-model='nowNode["parameters"]["beforeJS"]'></textarea>
|
||||
<label>最长等待脚本执行时间(0代表无限等待): </label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='nowNode["parameters"]["beforeJSWaitTime"]'></input>
|
||||
<label>点击该元素<strong>后</strong>针对该元素执行一段JavaScript脚本: </label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" placeholder='该元素用arguments[0]来表示,示例JS代码:arguments[0].click()即点击此元素' v-model='nowNode["parameters"]["afterJS"]'></textarea>
|
||||
<label>最长等待脚本执行时间(0代表无限等待): </label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='nowNode["parameters"]["afterJSWaitTime"]'></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -237,6 +239,8 @@
|
||||
<p>XPath(所有XPath内均可用Field["字段名"]表示参数值,用eval("你的代码")来替换成自定义的变量): <span style="font-size: 30px!important;" title="相对XPATH写法:以/开头,如循环项XPATH为/html/body/div[1],您的输入为/*[@id='tab-customer'],则最终寻址的xpath为:/html/body/div[1]/*[@id='tab-customer']">☺</span></p>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='params.parameters[paraIndex]["relativeXPath"]' placeholder="如果要写相对循环内的xpath,可以写如*../div[1]即匹配当前循环元素的父元素的第一个div子元素"></textarea>
|
||||
<p><button type="button" data-toggle="modal" data-target="#myModal_XPath" @click="changeXPaths(params.parameters[paraIndex]['allXPaths'])" class="btn btn-primary" style="margin-top: 10px">点此查看其他等价的XPath</button></p>
|
||||
<label>任务运行时最终定位的本字段XPath:</label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" readonly style="background:ghostwhite">{{getFinalXPath(params.parameters[paraIndex]['relativeXPath'], params.parameters[paraIndex]['relative'])}}</textarea>
|
||||
<p style="margin-top: 10px">
|
||||
<a class="btn btn-primary" data-toggle="collapse" href="#elementAdvanced" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||
点此展开/折叠自定义操作
|
||||
@ -256,21 +260,6 @@
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" required class="form-control" type="number" v-model.number='params.parameters[paraIndex]["afterJSWaitTime"]'></input>
|
||||
</div>
|
||||
</div>
|
||||
<label>参数类型转换为(用于Excel和数据库):</label>
|
||||
<select v-model='params.parameters[paraIndex]["paraType"]' class="form-control">
|
||||
<option value = "text">文本(单个值长度预估超过1万请选择大文本)</option>
|
||||
<option value = "int">整数(位数在9位以内)</option>
|
||||
<option value = "double">浮点数(小数)</option>
|
||||
<option value = "mediumText">大文本(单个值长度超过1万低于100万)</option>
|
||||
<option value = "datetime">日期时间</option>
|
||||
<option value = "date">日期</option>
|
||||
<option value = "time">时间</option>
|
||||
<option value = "varchar">小文本(单个值长度小于50)</option>
|
||||
<option value = "longText">超大文本(单个值长度超过100万)</option>
|
||||
<option value = "bigInt">大整数(位数超过9位)</option>
|
||||
</select>
|
||||
<label>元素找不到时的值:</label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" class="form-control" v-model='params.parameters[paraIndex]["default"]'></input>
|
||||
<label>采集内容类型</label>
|
||||
<select v-model='params.parameters[paraIndex]["contentType"]' class="form-control">
|
||||
<option :value = 0>文本(包括子元素)</option>
|
||||
@ -320,6 +309,21 @@
|
||||
<!-- <option :value = 0>普通提取</option>-->
|
||||
<!-- <option :value = 1>OCR提取</option>-->
|
||||
<!-- </select>-->
|
||||
<label>参数类型转换为(用于Excel和数据库):</label>
|
||||
<select v-model='params.parameters[paraIndex]["paraType"]' class="form-control">
|
||||
<option value = "text">文本(单个值长度预估超过1万请选择大文本)</option>
|
||||
<option value = "int">整数(位数在9位以内)</option>
|
||||
<option value = "double">浮点数(小数)</option>
|
||||
<option value = "mediumText">大文本(单个值长度超过1万低于100万)</option>
|
||||
<option value = "datetime">日期时间</option>
|
||||
<option value = "date">日期</option>
|
||||
<option value = "time">时间</option>
|
||||
<option value = "varchar">小文本(单个值长度小于50)</option>
|
||||
<option value = "longText">超大文本(单个值长度超过100万)</option>
|
||||
<option value = "bigInt">大整数(位数超过9位)</option>
|
||||
</select>
|
||||
<label>元素找不到时的值:</label>
|
||||
<input spellcheck=false onkeydown="inputDelete(event)" class="form-control" v-model='params.parameters[paraIndex]["default"]'></input>
|
||||
<label style="margin-top: 15px">是否将内容换行(长文章采集想要换行时设置):</label>
|
||||
<select v-model='params.parameters[paraIndex]["splitLine"]' class="form-control">
|
||||
<option :value = 0>否</option>
|
||||
@ -517,8 +521,10 @@ print(emotlib.emoji()) # 使用其中的函数。
|
||||
</div>
|
||||
<div>
|
||||
<label>XPath: </label>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='nowNode["parameters"]["xpath"]'></textarea>
|
||||
<textarea spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" v-model='xpath'></textarea>
|
||||
<p><button type="button" data-toggle="modal" data-target="#myModal_XPath" @click="changeXPaths(nowNode['parameters']['allXPaths'])" class="btn btn-primary" style="margin-top: 10px">点此查看其他等价的XPath</button></p>
|
||||
<label>任务运行时最终定位的本元素XPath:</label>
|
||||
<textarea v-model="getFinalXPath(nowNode['parameters']['xpath'], useLoop)" spellcheck=false onkeydown="inputDelete(event)" class="form-control" rows="2" readonly style="background:ghostwhite"></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -188,20 +188,34 @@ function notifyParameterNum(num) {
|
||||
ws.send(JSON.stringify(message));
|
||||
}
|
||||
|
||||
function trailElement(node, type = 1) {
|
||||
// type=0代表标记节点,type=1代表试运行
|
||||
let parentNode = nodeList[actionSequence[node["parentId"]]];
|
||||
if (node.option == 10) { //条件分支的话,传父元素的父元素
|
||||
function updateParentNode() {
|
||||
// console.log("updateParentNode")
|
||||
let parentNode = nodeList[actionSequence[app._data.nowNode["parentId"]]];
|
||||
if (app._data.nowNode.option == 10) { //条件分支的话,传父元素的父元素
|
||||
parentNode = nodeList[actionSequence[parentNode["parentId"]]];
|
||||
}
|
||||
if (parentNode.option == 10) { //如果父元素是条件分支,传父元素的爷爷元素
|
||||
parentNode = nodeList[actionSequence[parentNode["parentId"]]];
|
||||
parentNode = nodeList[actionSequence[parentNode["parentId"]]];
|
||||
}
|
||||
app._data.parentNode = parentNode;
|
||||
}
|
||||
|
||||
function trailElement(node, type = 1) {
|
||||
// type=0代表标记节点,type=1代表试运行
|
||||
// let parentNode = nodeList[actionSequence[node["parentId"]]];
|
||||
// if (node.option == 10) { //条件分支的话,传父元素的父元素
|
||||
// parentNode = nodeList[actionSequence[parentNode["parentId"]]];
|
||||
// }
|
||||
// if (parentNode.option == 10) { //如果父元素是条件分支,传父元素的爷爷元素
|
||||
// parentNode = nodeList[actionSequence[parentNode["parentId"]]];
|
||||
// parentNode = nodeList[actionSequence[parentNode["parentId"]]];
|
||||
// }
|
||||
updateParentNode();
|
||||
let message = {
|
||||
type: 4, //消息类型,4代表试运行事件
|
||||
from: 1, //0代表从浏览器到流程图,1代表从流程图到浏览器
|
||||
message: {"type": type, "node": JSON.stringify(node), "parentNode": JSON.stringify(parentNode)}
|
||||
message: {"type": type, "node": JSON.stringify(node), "parentNode": JSON.stringify(app._data.parentNode)}
|
||||
};
|
||||
ws.send(JSON.stringify(message));
|
||||
console.log(node);
|
||||
@ -214,6 +228,7 @@ function handleElement() {
|
||||
app._data["nowNode"] = nodeList[vueData.nowNodeIndex];
|
||||
app._data["nodeType"] = app._data["nowNode"]["option"];
|
||||
app._data.useLoop = app._data["nowNode"]["parameters"]["useLoop"];
|
||||
app._data.xpath = app._data["nowNode"]["parameters"]["xpath"];
|
||||
app._data["codeMode"] = -1; //自定义初始化
|
||||
if (app._data["nodeType"] == 8) {
|
||||
app._data.loopType = app._data["nowNode"]["parameters"]["loopType"];
|
||||
|
File diff suppressed because one or more lines are too long
1
ElectronJS/tasks/310.json
Normal file
1
ElectronJS/tasks/310.json
Normal file
File diff suppressed because one or more lines are too long
2
ExecuteStage/.vscode/launch.json
vendored
2
ExecuteStage/.vscode/launch.json
vendored
@ -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", "[10]", "--headless", "0", "--user_data", "0", "--keyboard", "0",
|
||||
"args": ["--ids", "[63]", "--headless", "0", "--user_data", "0", "--keyboard", "0",
|
||||
"--read_type", "remote"]
|
||||
// "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"
|
||||
}
|
||||
|
@ -768,6 +768,8 @@ class BrowserThread(Thread):
|
||||
elif int(codeMode) == 5:
|
||||
try:
|
||||
code = readCode(code)
|
||||
# global_namespace = globals().copy()
|
||||
# global_namespace["self"] = self
|
||||
output = exec(code)
|
||||
self.recordLog("执行下面的代码:" + code)
|
||||
self.recordLog("Execute the following code:" + code)
|
||||
|
@ -23,7 +23,7 @@ For more complex operations, please download the source code and compile it for
|
||||
"""
|
||||
|
||||
# 请在下面编写你的代码,不要有代码缩进!!! | Please write your code below, do not indent the code!!!
|
||||
|
||||
print(globals())
|
||||
# 导包 | Import packages
|
||||
from selenium.common.exceptions import ElementClickInterceptedException
|
||||
|
||||
@ -56,3 +56,20 @@ finally:
|
||||
print("All parameters:", self.outputParameters)
|
||||
print(test(3))
|
||||
print("执行完毕|Execution completed")
|
||||
|
||||
import time
|
||||
time.sleep(3)
|
||||
|
||||
def new_line(outputParameters, maxViewLength, record):
|
||||
line = []
|
||||
print("Use this function to print a new line in the console")
|
||||
i = 0
|
||||
for value in outputParameters.values():
|
||||
line.append(value)
|
||||
if record[i]:
|
||||
print(value[:maxViewLength], " ", end="")
|
||||
i += 1
|
||||
print("")
|
||||
return line
|
||||
|
||||
new_line(self.outputParameters, 10, [True, True, True, True, True, True, True, True, True, True, True, True, True, True, True])
|
Loading…
x
Reference in New Issue
Block a user