Input Function Update and solved path including spaces

This commit is contained in:
naibo 2023-03-24 02:39:52 +08:00
parent 4e87c081c6
commit 5a8b9adaa3
26 changed files with 139083 additions and 69608 deletions

Binary file not shown.

Binary file not shown.

View File

@ -6,5 +6,5 @@ rmdir/s /q out\EasySpider\resources\app\tasks
rmdir/s /q out\EasySpider\resources\app\user_data rmdir/s /q out\EasySpider\resources\app\user_data
rmdir /s /q out\EasySpider\resources\app\execution_instances rmdir /s /q out\EasySpider\resources\app\execution_instances
rmdir /s /q ..\Releases\EasySpider_windows_amd64\EasySpider rmdir /s /q ..\Releases\EasySpider_windows_amd64\EasySpider
del out\EasySpider\resources\app\tasks\vs_BuildTools.exe del out\EasySpider\resources\app\vs_BuildTools.exe
move out\EasySpider ..\Releases\EasySpider_windows_amd64\EasySpider move out\EasySpider ..\Releases\EasySpider_windows_amd64\EasySpider

View File

@ -1 +1 @@
{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data"} {"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./New Folder/user_data","absolute_user_data_folder":"D:\\Documents\\Projects\\EasySpider\\ElectronJS\\New Folder\\user_data"}

View File

@ -1,6 +1,13 @@
// Modules to control application life and create native browser window // Modules to control application life and create native browser window
const { app, BrowserWindow, dialog, ipcMain, screen } = require('electron'); const { app, BrowserWindow, dialog, ipcMain, screen } = require('electron');
app.commandLine.appendSwitch("--disable-http-cache"); app.commandLine.appendSwitch("--disable-http-cache");
const { Builder, By, Key, until } = require("selenium-webdriver");
const chrome = require('selenium-webdriver/chrome');
const { ServiceBuilder } = require('selenium-webdriver/chrome');
const { rootCertificates } = require('tls');
const { exit } = require('process');
const {windowManager} = require("node-window-manager");
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const {exec} = require('child_process'); const {exec} = require('child_process');
@ -115,14 +122,14 @@ function beginInvoke(msg) {
flowchart_window.show(); flowchart_window.show();
} else if (msg.type == 2) { } else if (msg.type == 2) {
//keyboard //keyboard
const robot = require("@jitsi/robotjs"); // const robot = require("@jitsi/robotjs");
//TODO 实现全选并删除功能,目前没有 let keyInfo = msg.message.keyboardStr;
keyInfo = msg.message.keyboardStr.split("BS}")[1]; driver.findElement(By.xpath(msg.message.xpath)).sendKeys(Key.HOME, Key.chord(Key.SHIFT, Key.END), keyInfo);
robot.keyTap("a", "control"); // robot.keyTap("a", "control");
robot.keyTap("backspace"); // robot.keyTap("backspace");
robot.typeString(keyInfo); // robot.typeString(keyInfo);
robot.keyTap("shift"); // robot.keyTap("shift");
robot.keyTap("shift"); // robot.keyTap("shift");
} else if (msg.type == 3) { } else if (msg.type == 3) {
try { try {
if (msg.from == 0) { if (msg.from == 0) {
@ -141,11 +148,12 @@ function beginInvoke(msg) {
let parameters = []; let parameters = [];
console.log(msg.message) console.log(msg.message)
if(msg.message.user_data_folder == null || msg.message.user_data_folder == undefined || msg.message.user_data_folder == ""){ if(msg.message.user_data_folder == null || msg.message.user_data_folder == undefined || msg.message.user_data_folder == ""){
parameters = ["--id", msg.message.id, "--server_address", server_address]; parameters = ["--id", msg.message.id, "--server_address", server_address, "--user_data", 0];
} else { } else {
let user_data_folder_path = __dirname.indexOf("resources")>=0 && __dirname.indexOf("app")>=0? path.join(__dirname, "../../..", msg.message.user_data_folder): path.join(__dirname, msg.message.user_data_folder); let user_data_folder_path = __dirname.indexOf("resources")>=0 && __dirname.indexOf("app")>=0? path.join(__dirname, "../../..", msg.message.user_data_folder): path.join(__dirname, msg.message.user_data_folder);
parameters = ["--id", msg.message.id, "--server_address", server_address, "--user_data_folder", user_data_folder_path]; parameters = ["--id", msg.message.id, "--server_address", server_address, "--user_data", 1];
config.user_data_folder = msg.message.user_data_folder; config.user_data_folder = msg.message.user_data_folder;
config.absolute_user_data_folder = user_data_folder_path;
fs.writeFileSync(path.join(task_server.getDir(), "config.json"), JSON.stringify(config)); fs.writeFileSync(path.join(task_server.getDir(), "config.json"), JSON.stringify(config));
} }
// child('Chrome/easyspider_executestage.exe', parameters, function(err,stdout, stderr) { // child('Chrome/easyspider_executestage.exe', parameters, function(err,stdout, stderr) {
@ -188,13 +196,6 @@ wss.on('connection', function (ws) {
}); });
}); });
const { Builder, By, Key, until } = require("selenium-webdriver");
const chrome = require('selenium-webdriver/chrome');
const { ServiceBuilder } = require('selenium-webdriver/chrome');
const { rootCertificates } = require('tls');
const { exit } = require('process');
const {windowManager} = require("node-window-manager");
console.log(process.platform); console.log(process.platform);
async function runBrowser(lang="en", user_data_folder='') { async function runBrowser(lang="en", user_data_folder='') {

View File

@ -534,6 +534,11 @@
"node-gyp-build": "^4.3.0" "node-gyp-build": "^4.3.0"
} }
}, },
"node_modules/@jitsi/robotjs/node_modules/node-addon-api": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
"integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ=="
},
"node_modules/@malept/cross-spawn-promise": { "node_modules/@malept/cross-spawn-promise": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz", "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz",
@ -3899,11 +3904,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/node-addon-api": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
"integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ=="
},
"node_modules/node-api-version": { "node_modules/node-api-version": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz", "resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz",

View File

@ -30,7 +30,6 @@
}, },
"repository": "https://github.com/electron/electron-quick-start", "repository": "https://github.com/electron/electron-quick-start",
"dependencies": { "dependencies": {
"@jitsi/robotjs": "^0.6.11",
"electron-squirrel-startup": "^1.0.0", "electron-squirrel-startup": "^1.0.0",
"http": "^0.0.1-security", "http": "^0.0.1-security",
"node-window-manager": "^2.2.4", "node-window-manager": "^2.2.4",
@ -44,10 +43,10 @@
"icon": "favicon.ico", "icon": "favicon.ico",
"appVersion": "0.1.0", "appVersion": "0.1.0",
"name": "EasySpider", "name": "EasySpider",
"appCopyright": "Naibo Wang(naibowang@foxmail.com)", "appCopyright": "Naibo Wang (naibowang@foxmail.com)",
"win32metadata": { "win32metadata": {
"ProductName": "EasySpider", "ProductName": "EasySpider",
"CompanyName": "王乃博 (浙江大学)", "CompanyName": "王乃博 (浙江大学与新加坡国立大学)",
"FileDescription": "EasySpider" "FileDescription": "EasySpider"
} }
}, },

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# This script is used to build the package for Linux 64-bit. # This script is used to build.md the package for Linux 64-bit.
rm -r out rm -r out
npm run package npm run package
mv out/EasySpider-linux-x64 out/EasySpider mv out/EasySpider-linux-x64 out/EasySpider

View File

@ -6260,7 +6260,7 @@ var Vue = (function (exports) {
if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) { if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
// determine anchor, adopt content // determine anchor, adopt content
nextNode = node; nextNode = node;
// if the static vnode has its content stripped during build, // if the static vnode has its content stripped during build.md,
// adopt it from the server-rendered HTML. // adopt it from the server-rendered HTML.
const needToAdoptContent = !vnode.children.length; const needToAdoptContent = !vnode.children.length;
for (let i = 0; i < vnode.staticCount; i++) { for (let i = 0; i < vnode.staticCount; i++) {
@ -7468,7 +7468,7 @@ var Vue = (function (exports) {
else { else {
const s1 = i; // prev starting index const s1 = i; // prev starting index
const s2 = i; // next starting index const s2 = i; // next starting index
// 5.1 build key:index map for newChildren // 5.1 build.md key:index map for newChildren
const keyToNewIndexMap = new Map(); const keyToNewIndexMap = new Map();
for (i = s2; i <= e2; i++) { for (i = s2; i <= e2; i++) {
const nextChild = (c2[i] = optimized const nextChild = (c2[i] = optimized
@ -13754,7 +13754,7 @@ var Vue = (function (exports) {
}; };
// Important: since this function uses Node.js only dependencies, it should // Important: since this function uses Node.js only dependencies, it should
// always be used with a leading !true check so that it can be // always be used with a leading !true check so that it can be
// tree-shaken from the browser build. // tree-shaken from the browser build.md.
function processExpression(node, context, function processExpression(node, context,
// some expressions like v-slot props & v-for aliases should be parsed as // some expressions like v-slot props & v-for aliases should be parsed as
// function params // function params
@ -14239,7 +14239,7 @@ var Vue = (function (exports) {
}; };
const buildClientSlotFn = (props, children, loc) => createFunctionExpression(props, children, false /* newline */, true /* isSlot */, children.length ? children[0].loc : loc); const buildClientSlotFn = (props, children, loc) => createFunctionExpression(props, children, false /* newline */, true /* isSlot */, children.length ? children[0].loc : loc);
// Instead of being a DirectiveTransform, v-slot processing is called during // Instead of being a DirectiveTransform, v-slot processing is called during
// transformElement to build the slots object for a component. // transformElement to build.md the slots object for a component.
function buildSlots(node, context, buildSlotFn = buildClientSlotFn) { function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
context.helper(WITH_CTX); context.helper(WITH_CTX);
const { children, loc } = node; const { children, loc } = node;
@ -14761,7 +14761,7 @@ var Vue = (function (exports) {
hasDynamicKeys = true; hasDynamicKeys = true;
if (exp) { if (exp) {
if (isVBind) { if (isVBind) {
// have to merge early for compat build check // have to merge early for compat build.md check
pushMergeArg(); pushMergeArg();
mergeArgs.push(exp); mergeArgs.push(exp);
} }
@ -15948,7 +15948,7 @@ var Vue = (function (exports) {
})); }));
} }
// This entry is the "full-build" that includes both the runtime // This entry is the "full-build.md" that includes both the runtime
{ {
initDev(); initDev();
} }
@ -15998,7 +15998,7 @@ var Vue = (function (exports) {
} }
// The wildcard import results in a huge object with every export // The wildcard import results in a huge object with every export
// with keys that cannot be mangled, and can be quite heavy size-wise. // with keys that cannot be mangled, and can be quite heavy size-wise.
// In the global build we know `Vue` is available globally so we can avoid // In the global build.md we know `Vue` is available globally so we can avoid
// the wildcard object. // the wildcard object.
const render = (new Function(code)() ); const render = (new Function(code)() );
render._rc = true; render._rc = true;

View File

@ -4028,9 +4028,9 @@
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
vm.$options.el || el) { vm.$options.el || el) {
warn( warn(
'You are using the runtime-only build of Vue where the template ' + 'You are using the runtime-only build.md of Vue where the template ' +
'compiler is not available. Either pre-compile the templates into ' + 'compiler is not available. Either pre-compile the templates into ' +
'render functions, or use the compiler-included build.', 'render functions, or use the compiler-included build.md.',
vm vm
); );
} else { } else {
@ -4309,7 +4309,7 @@
id = watcher.id; id = watcher.id;
has[id] = null; has[id] = null;
watcher.run(); watcher.run();
// in dev build, check and stop circular updates. // in dev build.md, check and stop circular updates.
if (has[id] != null) { if (has[id] != null) {
circular[id] = (circular[id] || 0) + 1; circular[id] = (circular[id] || 0) + 1;
if (circular[id] > MAX_UPDATE_COUNT) { if (circular[id] > MAX_UPDATE_COUNT) {
@ -4904,7 +4904,7 @@
function stateMixin (Vue) { function stateMixin (Vue) {
// flow somehow has problems with directly declared definition object // flow somehow has problems with directly declared definition object
// when using Object.defineProperty, so we have to procedurally build up // when using Object.defineProperty, so we have to procedurally build.md up
// the object here. // the object here.
var dataDef = {}; var dataDef = {};
dataDef.get = function () { return this._data }; dataDef.get = function () { return this._data };
@ -11673,7 +11673,7 @@
} catch (e) { } catch (e) {
if (e.toString().match(/unsafe-eval|CSP/)) { if (e.toString().match(/unsafe-eval|CSP/)) {
warn$$1( warn$$1(
'It seems you are using the standalone build of Vue.js in an ' + 'It seems you are using the standalone build.md of Vue.js in an ' +
'environment with Content Security Policy that prohibits unsafe-eval. ' + 'environment with Content Security Policy that prohibits unsafe-eval. ' +
'The template compiler cannot work in this environment. Consider ' + 'The template compiler cannot work in this environment. Consider ' +
'relaxing the policy to allow unsafe-eval or pre-compiling your ' + 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +

File diff suppressed because one or more lines are too long

View File

@ -676,7 +676,7 @@ if __name__ == '__main__':
"server_address": "http://localhost:8074", "server_address": "http://localhost:8074",
"saved_file_name": "", "saved_file_name": "",
"read_type": "remote", "read_type": "remote",
"user_data_folder": "", "user_data": False,
} }
c = Config(config) c = Config(config)
print(c) print(c)
@ -747,8 +747,12 @@ if __name__ == '__main__':
# 2. User Profile文件夹的路径是C:\Users\用户名\AppData\Local\Google\Chrome\User Data不要加Default # 2. User Profile文件夹的路径是C:\Users\用户名\AppData\Local\Google\Chrome\User Data不要加Default
# 3. 就算User Profile相同chrome版本不同所存储的cookie信息也不同也不能爬 # 3. 就算User Profile相同chrome版本不同所存储的cookie信息也不同也不能爬
# 4. TMALL如果一直弹出验证码而且无法通过验证那么需要在其他浏览器上用 # 4. TMALL如果一直弹出验证码而且无法通过验证那么需要在其他浏览器上用
if c.user_data_folder != "": if c.user_data:
option.add_argument(f'--user-data-dir={c.user_data_folder}') # TMALL 反扒 with open("config.json","r") as f:
config = json.load(f)
absolute_user_data_folder = config["absolute_user_data_folder"]
print("\nAbsolute_user_data_folder:",absolute_user_data_folder,"\n")
option.add_argument(f'--user-data-dir={absolute_user_data_folder}') # TMALL 反扒
option.add_argument("--profile-directory=Default") option.add_argument("--profile-directory=Default")
# options.add_argument( # options.add_argument(
# '--user-data-dir=C:\\Users\\q9823\\AppData\\Local\\Google\\Chrome\\User Data') # TMALL 反扒 # '--user-data-dir=C:\\Users\\q9823\\AppData\\Local\\Google\\Chrome\\User Data') # TMALL 反扒

View File

@ -25,7 +25,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
} else if (request.type == 2) { } else if (request.type == 2) {
let message = { let message = {
type: 2, //消息类型2代表键盘输入 type: 2, //消息类型2代表键盘输入
message: { "keyboardStr": "{}{BS}" + request.msg } // {}全选{BS}退格 message: { "keyboardStr": request.value, "xpath": request.xpath } // {}全选{BS}退格
}; };
ws.send(JSON.stringify(message)); ws.send(JSON.stringify(message));
} else if (request.type == 3) { } else if (request.type == 3) {
@ -34,7 +34,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
let message = { let message = {
type: 3, //消息类型3代表元素增加事件 type: 3, //消息类型3代表元素增加事件
from: 0, //0代表从浏览器到流程图1代表从流程图到浏览器 from: 0, //0代表从浏览器到流程图1代表从流程图到浏览器
message: { "pipe": JSON.stringify(request.msg) } // {}全选{BS}退格 message: {"pipe": JSON.stringify(request.msg)}
}; };
console.log(message); console.log(message);
ws.send(JSON.stringify(message)); ws.send(JSON.stringify(message));

View File

@ -25,7 +25,7 @@ export function input(value) {
}; };
let msg = { "type": 3, msg: message }; let msg = { "type": 3, msg: message };
chrome.runtime.sendMessage(msg); chrome.runtime.sendMessage(msg);
msg = { "type": 2, msg: value }; msg = { "type": 2, value: value, xpath: message.xpath };
chrome.runtime.sendMessage(msg); chrome.runtime.sendMessage(msg);
} }

View File

@ -115,7 +115,8 @@
<input id="WTextBox" v-model="text" autoFocus="autofocus" type="text"></input> <input id="WTextBox" v-model="text" autoFocus="autofocus" type="text"></input>
<button style="margin-left:0px!important;" v-on:click="getInput">确定</button> <button style="margin-left:0px!important;" v-on:click="getInput">确定</button>
<button style="margin-left:0px!important;" v-on:click="cancelInput">取消</button> <button style="margin-left:0px!important;" v-on:click="cancelInput">取消</button>
<div class="innercontent"> <div style="text-align: justify;margin-top: 15px;padding-right: 15px;margin-left: 4px">
如果点击确定按钮后文本框没有自动填充且流程图中没有显示输入文字节点重试即可
</div> </div>
</div> </div>
</div> </div>
@ -241,7 +242,8 @@
<input id="WTextBox" v-model="text" autofocus="autofocus" type="text"></input> <input id="WTextBox" v-model="text" autofocus="autofocus" type="text"></input>
<button style="margin-left:0px!important;" v-on:click="getInput">Confirm</button> <button style="margin-left:0px!important;" v-on:click="getInput">Confirm</button>
<button style="margin-left:0px!important;" v-on:click="cancelInput">Cancel</button> <button style="margin-left:0px!important;" v-on:click="cancelInput">Cancel</button>
<div class="innercontent"> <div style="text-align: justify;margin-top: 15px;padding-right: 15px;margin-left: 4px">
If the text box does not auto-populate after clicking the "Confirm" button, and the "Input Text" operation is not displayed in the workflow manager, please try again.
</div> </div>
</div> </div>
</div> </div>
@ -403,11 +405,11 @@ export default {
}, },
getInput: function () { // getInput: function () { //
global.nodeList[0]["node"].focus(); // global.nodeList[0]["node"].focus(); //
if (getOS() == "Mac") { // if (getOS() == "Mac") {
global.nodeList[0]["node"].setAttribute("value", this.text); // box // global.nodeList[0]["node"].setAttribute("value", this.text); // box
} else{ // } else{
global.nodeList[0]["node"].setAttribute("value", ""); // box // global.nodeList[0]["node"].setAttribute("value", ""); // box
} // }
input(this.text); // input(this.text); //
this.text = ""; this.text = "";
clearEl(); clearEl();

1
Releases/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
EasySpider

View File

@ -1 +0,0 @@
EasySpider/

View File

@ -1 +1 @@
{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data"} {"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":"D:\\Documents\\Projects\\EasySpider\\Releases\\EasySpider_windows_amd64\\user_data"}

View File

@ -1 +0,0 @@
EasySpider/

View File

@ -1 +1 @@
{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data"} {"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":"D:\\Documents\\Projects\\EasySpider\\Releases\\EasySpider_windows_amd64\\user_data"}

View File

@ -1 +0,0 @@
EasySpider/

View File

@ -1 +1 @@
{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data"} {"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":"D:\\Documents\\Projects\\EasySpider\\Releases\\EasySpider_windows_amd64\\user_data"}

File diff suppressed because one or more lines are too long

View File