mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-19 23:14:54 +08:00
Input Function Update and solved path including spaces
This commit is contained in:
parent
4e87c081c6
commit
5a8b9adaa3
Binary file not shown.
Binary file not shown.
@ -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\execution_instances
|
||||
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
|
@ -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"}
|
@ -1,6 +1,13 @@
|
||||
// Modules to control application life and create native browser window
|
||||
const { app, BrowserWindow, dialog, ipcMain, screen } = require('electron');
|
||||
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 fs = require('fs');
|
||||
const {exec} = require('child_process');
|
||||
@ -115,14 +122,14 @@ function beginInvoke(msg) {
|
||||
flowchart_window.show();
|
||||
} else if (msg.type == 2) {
|
||||
//keyboard
|
||||
const robot = require("@jitsi/robotjs");
|
||||
//TODO 实现全选并删除功能,目前没有
|
||||
keyInfo = msg.message.keyboardStr.split("BS}")[1];
|
||||
robot.keyTap("a", "control");
|
||||
robot.keyTap("backspace");
|
||||
robot.typeString(keyInfo);
|
||||
robot.keyTap("shift");
|
||||
robot.keyTap("shift");
|
||||
// const robot = require("@jitsi/robotjs");
|
||||
let keyInfo = msg.message.keyboardStr;
|
||||
driver.findElement(By.xpath(msg.message.xpath)).sendKeys(Key.HOME, Key.chord(Key.SHIFT, Key.END), keyInfo);
|
||||
// robot.keyTap("a", "control");
|
||||
// robot.keyTap("backspace");
|
||||
// robot.typeString(keyInfo);
|
||||
// robot.keyTap("shift");
|
||||
// robot.keyTap("shift");
|
||||
} else if (msg.type == 3) {
|
||||
try {
|
||||
if (msg.from == 0) {
|
||||
@ -141,11 +148,12 @@ function beginInvoke(msg) {
|
||||
let parameters = [];
|
||||
console.log(msg.message)
|
||||
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 {
|
||||
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.absolute_user_data_folder = user_data_folder_path;
|
||||
fs.writeFileSync(path.join(task_server.getDir(), "config.json"), JSON.stringify(config));
|
||||
}
|
||||
// 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);
|
||||
|
||||
async function runBrowser(lang="en", user_data_folder='') {
|
||||
|
10
ElectronJS/package-lock.json
generated
10
ElectronJS/package-lock.json
generated
@ -534,6 +534,11 @@
|
||||
"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": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz",
|
||||
@ -3899,11 +3904,6 @@
|
||||
"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": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz",
|
||||
|
@ -30,7 +30,6 @@
|
||||
},
|
||||
"repository": "https://github.com/electron/electron-quick-start",
|
||||
"dependencies": {
|
||||
"@jitsi/robotjs": "^0.6.11",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"http": "^0.0.1-security",
|
||||
"node-window-manager": "^2.2.4",
|
||||
@ -44,10 +43,10 @@
|
||||
"icon": "favicon.ico",
|
||||
"appVersion": "0.1.0",
|
||||
"name": "EasySpider",
|
||||
"appCopyright": "Naibo Wang(naibowang@foxmail.com)",
|
||||
"appCopyright": "Naibo Wang (naibowang@foxmail.com)",
|
||||
"win32metadata": {
|
||||
"ProductName": "EasySpider",
|
||||
"CompanyName": "王乃博 (浙江大学)",
|
||||
"CompanyName": "王乃博 (浙江大学与新加坡国立大学)",
|
||||
"FileDescription": "EasySpider"
|
||||
}
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/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
|
||||
npm run package
|
||||
mv out/EasySpider-linux-x64 out/EasySpider
|
||||
|
@ -6260,7 +6260,7 @@ var Vue = (function (exports) {
|
||||
if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
|
||||
// determine anchor, adopt content
|
||||
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.
|
||||
const needToAdoptContent = !vnode.children.length;
|
||||
for (let i = 0; i < vnode.staticCount; i++) {
|
||||
@ -7468,7 +7468,7 @@ var Vue = (function (exports) {
|
||||
else {
|
||||
const s1 = i; // prev 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();
|
||||
for (i = s2; i <= e2; i++) {
|
||||
const nextChild = (c2[i] = optimized
|
||||
@ -13754,7 +13754,7 @@ var Vue = (function (exports) {
|
||||
};
|
||||
// Important: since this function uses Node.js only dependencies, it should
|
||||
// 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,
|
||||
// some expressions like v-slot props & v-for aliases should be parsed as
|
||||
// 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);
|
||||
// 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) {
|
||||
context.helper(WITH_CTX);
|
||||
const { children, loc } = node;
|
||||
@ -14761,7 +14761,7 @@ var Vue = (function (exports) {
|
||||
hasDynamicKeys = true;
|
||||
if (exp) {
|
||||
if (isVBind) {
|
||||
// have to merge early for compat build check
|
||||
// have to merge early for compat build.md check
|
||||
pushMergeArg();
|
||||
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();
|
||||
}
|
||||
@ -15998,7 +15998,7 @@ var Vue = (function (exports) {
|
||||
}
|
||||
// The wildcard import results in a huge object with every export
|
||||
// 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.
|
||||
const render = (new Function(code)() );
|
||||
render._rc = true;
|
||||
|
@ -4028,9 +4028,9 @@
|
||||
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
||||
vm.$options.el || el) {
|
||||
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 ' +
|
||||
'render functions, or use the compiler-included build.',
|
||||
'render functions, or use the compiler-included build.md.',
|
||||
vm
|
||||
);
|
||||
} else {
|
||||
@ -4309,7 +4309,7 @@
|
||||
id = watcher.id;
|
||||
has[id] = null;
|
||||
watcher.run();
|
||||
// in dev build, check and stop circular updates.
|
||||
// in dev build.md, check and stop circular updates.
|
||||
if (has[id] != null) {
|
||||
circular[id] = (circular[id] || 0) + 1;
|
||||
if (circular[id] > MAX_UPDATE_COUNT) {
|
||||
@ -4904,7 +4904,7 @@
|
||||
|
||||
function stateMixin (Vue) {
|
||||
// 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.
|
||||
var dataDef = {};
|
||||
dataDef.get = function () { return this._data };
|
||||
@ -11673,7 +11673,7 @@
|
||||
} catch (e) {
|
||||
if (e.toString().match(/unsafe-eval|CSP/)) {
|
||||
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. ' +
|
||||
'The template compiler cannot work in this environment. Consider ' +
|
||||
'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
||||
|
File diff suppressed because one or more lines are too long
@ -676,7 +676,7 @@ if __name__ == '__main__':
|
||||
"server_address": "http://localhost:8074",
|
||||
"saved_file_name": "",
|
||||
"read_type": "remote",
|
||||
"user_data_folder": "",
|
||||
"user_data": False,
|
||||
}
|
||||
c = Config(config)
|
||||
print(c)
|
||||
@ -747,8 +747,12 @@ if __name__ == '__main__':
|
||||
# 2. User Profile文件夹的路径是:C:\Users\用户名\AppData\Local\Google\Chrome\User Data不要加Default
|
||||
# 3. 就算User Profile相同,chrome版本不同所存储的cookie信息也不同,也不能爬
|
||||
# 4. TMALL如果一直弹出验证码,而且无法通过验证,那么需要在其他浏览器上用
|
||||
if c.user_data_folder != "":
|
||||
option.add_argument(f'--user-data-dir={c.user_data_folder}') # TMALL 反扒
|
||||
if c.user_data:
|
||||
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")
|
||||
# options.add_argument(
|
||||
# '--user-data-dir=C:\\Users\\q9823\\AppData\\Local\\Google\\Chrome\\User Data') # TMALL 反扒
|
||||
|
Binary file not shown.
Binary file not shown.
@ -25,7 +25,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||
} else if (request.type == 2) {
|
||||
let message = {
|
||||
type: 2, //消息类型,2代表键盘输入
|
||||
message: { "keyboardStr": "{}{BS}" + request.msg } // {}全选{BS}退格
|
||||
message: { "keyboardStr": request.value, "xpath": request.xpath } // {}全选{BS}退格
|
||||
};
|
||||
ws.send(JSON.stringify(message));
|
||||
} else if (request.type == 3) {
|
||||
@ -34,7 +34,7 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||
let message = {
|
||||
type: 3, //消息类型,3代表元素增加事件
|
||||
from: 0, //0代表从浏览器到流程图,1代表从流程图到浏览器
|
||||
message: { "pipe": JSON.stringify(request.msg) } // {}全选{BS}退格
|
||||
message: {"pipe": JSON.stringify(request.msg)}
|
||||
};
|
||||
console.log(message);
|
||||
ws.send(JSON.stringify(message));
|
||||
|
@ -25,7 +25,7 @@ export function input(value) {
|
||||
};
|
||||
let msg = { "type": 3, msg: message };
|
||||
chrome.runtime.sendMessage(msg);
|
||||
msg = { "type": 2, msg: value };
|
||||
msg = { "type": 2, value: value, xpath: message.xpath };
|
||||
chrome.runtime.sendMessage(msg);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,8 @@
|
||||
<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="cancelInput">取消</button>
|
||||
<div class="innercontent">
|
||||
<div style="text-align: justify;margin-top: 15px;padding-right: 15px;margin-left: 4px">
|
||||
如果点击“确定”按钮后文本框没有自动填充,且流程图中没有显示“输入文字”节点,重试即可。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -241,7 +242,8 @@
|
||||
<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="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>
|
||||
@ -403,11 +405,11 @@ export default {
|
||||
},
|
||||
getInput: function () { //得到输入的文字
|
||||
global.nodeList[0]["node"].focus(); //获得文字焦点
|
||||
if (getOS() == "Mac") {
|
||||
global.nodeList[0]["node"].setAttribute("value", this.text); // 设置输入 box内容
|
||||
} else{
|
||||
global.nodeList[0]["node"].setAttribute("value", ""); // 先设置为空,再设置输入 box内容
|
||||
}
|
||||
// if (getOS() == "Mac") {
|
||||
// global.nodeList[0]["node"].setAttribute("value", this.text); // 设置输入 box内容
|
||||
// } else{
|
||||
// global.nodeList[0]["node"].setAttribute("value", ""); // 先设置为空,再设置输入 box内容
|
||||
// }
|
||||
input(this.text); // 设置输入
|
||||
this.text = "";
|
||||
clearEl();
|
||||
|
1
Releases/.gitignore
vendored
Normal file
1
Releases/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
EasySpider
|
@ -1 +0,0 @@
|
||||
EasySpider/
|
@ -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"}
|
1
Releases/EasySpider_windows_386/.gitignore
vendored
1
Releases/EasySpider_windows_386/.gitignore
vendored
@ -1 +0,0 @@
|
||||
EasySpider/
|
@ -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"}
|
1
Releases/EasySpider_windows_amd64/.gitignore
vendored
1
Releases/EasySpider_windows_amd64/.gitignore
vendored
@ -1 +0,0 @@
|
||||
EasySpider/
|
@ -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
Loading…
x
Reference in New Issue
Block a user