mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-20 17:00:05 +08:00
参数索引值Bug修复
This commit is contained in:
parent
7aa0cf8fd9
commit
908235a738
@ -1147,7 +1147,7 @@ class BrowserThread(Thread):
|
|||||||
try:
|
try:
|
||||||
pageHTML = etree.HTML(self.browser.page_source)
|
pageHTML = etree.HTML(self.browser.page_source)
|
||||||
except:
|
except:
|
||||||
pageHTML = ""
|
pageHTML = etree.HTML("")
|
||||||
if loopElement != "": # 只在数据在循环中提取时才需要获取循环元素
|
if loopElement != "": # 只在数据在循环中提取时才需要获取循环元素
|
||||||
try:
|
try:
|
||||||
loopElementOuterHTML = loopElement.get_attribute('outerHTML')
|
loopElementOuterHTML = loopElement.get_attribute('outerHTML')
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -28,7 +28,8 @@ if(config.debug){
|
|||||||
process.stderr.write(util.format.apply(null, arguments) + '\n')
|
process.stderr.write(util.format.apply(null, arguments) + '\n')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let allWindowSockets = [];
|
||||||
|
let allWindowScoketNames = [];
|
||||||
task_server.start(config.webserver_port); //start local server
|
task_server.start(config.webserver_port); //start local server
|
||||||
let server_address = `${config.webserver_address}:${config.webserver_port}`;
|
let server_address = `${config.webserver_address}:${config.webserver_port}`;
|
||||||
const websocket_port = 8084; //目前只支持8084端口,写死,因为扩展里面写死了
|
const websocket_port = 8084; //目前只支持8084端口,写死,因为扩展里面写死了
|
||||||
@ -296,6 +297,13 @@ async function beginInvoke(msg, ws) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
socket_window.send(msg.message.pipe);
|
socket_window.send(msg.message.pipe);
|
||||||
|
for(let i in allWindowSockets){
|
||||||
|
try{
|
||||||
|
allWindowSockets[i].send(msg.message.pipe);
|
||||||
|
} catch {
|
||||||
|
console.log("Cannot send to socket with id: ", allWindowScoketNames[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
console.log("FROM Flowchart: ", JSON.parse(msg.message.pipe));
|
console.log("FROM Flowchart: ", JSON.parse(msg.message.pipe));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -351,6 +359,7 @@ async function beginInvoke(msg, ws) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const WebSocket = require('ws');
|
const WebSocket = require('ws');
|
||||||
|
const {all} = require("express/lib/application");
|
||||||
let socket_window = null;
|
let socket_window = null;
|
||||||
let socket_start = null;
|
let socket_start = null;
|
||||||
let socket_flowchart = null;
|
let socket_flowchart = null;
|
||||||
@ -381,6 +390,8 @@ wss.on('connection', function (ws) {
|
|||||||
handle_pairs[msg.message.id] = current_handle;
|
handle_pairs[msg.message.id] = current_handle;
|
||||||
console.log("Set handle_pair for id: ", msg.message.id, " to ", current_handle, ", title is: ", msg.message.title);
|
console.log("Set handle_pair for id: ", msg.message.id, " to ", current_handle, ", title is: ", msg.message.title);
|
||||||
socket_flowchart.send(JSON.stringify({"type": "title", "data": {"title":msg.message.title}}));
|
socket_flowchart.send(JSON.stringify({"type": "title", "data": {"title":msg.message.title}}));
|
||||||
|
allWindowSockets.push(ws);
|
||||||
|
allWindowScoketNames.push(msg.message.id);
|
||||||
// console.log("handle_pairs: ", handle_pairs);
|
// console.log("handle_pairs: ", handle_pairs);
|
||||||
}
|
}
|
||||||
} else if (msg.type == 10) {
|
} else if (msg.type == 10) {
|
||||||
@ -433,6 +444,7 @@ async function runBrowser(lang = "en", user_data_folder = '', mobile = false) {
|
|||||||
.build();
|
.build();
|
||||||
await driver.manage().setTimeouts({implicit: 10000, pageLoad: 10000, script: 10000});
|
await driver.manage().setTimeouts({implicit: 10000, pageLoad: 10000, script: 10000});
|
||||||
await driver.executeScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
|
await driver.executeScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
|
||||||
|
// await driver.executeScript("localStorage.clear();"); //重置参数数量
|
||||||
const cdpConnection = await driver.createCDPConnection("page");
|
const cdpConnection = await driver.createCDPConnection("page");
|
||||||
let stealth_path = path.join(__dirname, "stealth.min.js");
|
let stealth_path = path.join(__dirname, "stealth.min.js");
|
||||||
let stealth = fs.readFileSync(stealth_path, 'utf8');
|
let stealth = fs.readFileSync(stealth_path, 'utf8');
|
||||||
|
@ -128,7 +128,7 @@ let app = new Vue({
|
|||||||
"nodeType": 0,
|
"nodeType": 0,
|
||||||
"contentType": 0,
|
"contentType": 0,
|
||||||
"relative": false,
|
"relative": false,
|
||||||
"name": LANG("自定义参数_" + this.nowNode["parameters"]["paras"].length.toString(),"Custom_Field_" + this.nowNode["parameters"]["paras"].length.toString()),
|
"name": LANG("自定义参数_" + parameterNum.toString(),"Custom_Field_" + parameterNum.toString()),
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"extractType": 0,
|
"extractType": 0,
|
||||||
"relativeXPath": "//body",
|
"relativeXPath": "//body",
|
||||||
@ -150,6 +150,7 @@ let app = new Vue({
|
|||||||
"downloadPic": 0,
|
"downloadPic": 0,
|
||||||
"paraType": "text",
|
"paraType": "text",
|
||||||
});
|
});
|
||||||
|
notifyParameterNum(1);
|
||||||
this.paraIndex = this.nowNode["parameters"]["paras"].length - 1;
|
this.paraIndex = this.nowNode["parameters"]["paras"].length - 1;
|
||||||
setTimeout(function(){$("#app > div.elements > div.toolkitcontain > table.toolkittb4 > tbody > tr:last-child")[0].scrollIntoView(false); //滚动到底部
|
setTimeout(function(){$("#app > div.elements > div.toolkitcontain > table.toolkittb4 > tbody > tr:last-child")[0].scrollIntoView(false); //滚动到底部
|
||||||
}, 200);
|
}, 200);
|
||||||
|
@ -162,4 +162,5 @@
|
|||||||
app.$data.task = result;
|
app.$data.task = result;
|
||||||
app.$data.show = true;
|
app.$data.show = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -8,6 +8,7 @@ import iframe from "./iframe.vue";
|
|||||||
//表现逻辑层的处理
|
//表现逻辑层的处理
|
||||||
|
|
||||||
if (window.location.href.indexOf("backEndAddressServiceWrapper") >= 0) {
|
if (window.location.href.indexOf("backEndAddressServiceWrapper") >= 0) {
|
||||||
|
chrome.storage.local.set({ "parameterNum": 1 }); //重置参数索引值
|
||||||
throw "serviceGrid"; //如果是服务器网页页面,则不执行工具
|
throw "serviceGrid"; //如果是服务器网页页面,则不执行工具
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,13 @@ global.ws.onopen = function() {
|
|||||||
};
|
};
|
||||||
this.send(JSON.stringify(message));
|
this.send(JSON.stringify(message));
|
||||||
};
|
};
|
||||||
|
global.ws.onmessage = function(evt) {
|
||||||
|
evt = JSON.parse(evt.data);
|
||||||
|
if (evt["type"] == "0") { //0代表更新参数添加索引值
|
||||||
|
chrome.storage.local.set({ "parameterNum": parseInt(evt["value"]) }); //修改值
|
||||||
|
console.log("更新参数添加索引值为:" + evt["value"]);
|
||||||
|
}
|
||||||
|
};
|
||||||
export function input(value) {
|
export function input(value) {
|
||||||
let message = {
|
let message = {
|
||||||
"type": "inputText",
|
"type": "inputText",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
"description": "EasySpider's chrome extension",
|
"description": "EasySpider's chrome extension",
|
||||||
"author": "Naibo Wang",
|
"author": "Naibo Wang",
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
|
"persistent": true,
|
||||||
"action": {
|
"action": {
|
||||||
"default_icon": {
|
"default_icon": {
|
||||||
"16": "assets/icon-16.png",
|
"16": "assets/icon-16.png",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user