mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-20 17:00:05 +08:00
MacOS
This commit is contained in:
parent
fce97dec61
commit
960cf74de1
BIN
ElectronJS/EasySpider_zh.crx
Normal file
BIN
ElectronJS/EasySpider_zh.crx
Normal file
Binary file not shown.
@ -654,7 +654,11 @@ async function beginInvoke(msg, ws) {
|
|||||||
if (parameters.clickWay == 2){ //双击
|
if (parameters.clickWay == 2){ //双击
|
||||||
await click_element(element, "double");
|
await click_element(element, "double");
|
||||||
} else {
|
} else {
|
||||||
await click_element(element); //单击
|
if (parameters.newTab == 1){
|
||||||
|
await click_element(element, "loopClickEvery"); //新标签页打开
|
||||||
|
} else {
|
||||||
|
await click_element(element); //单击
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let alertHandleType = parameters.alertHandleType;
|
let alertHandleType = parameters.alertHandleType;
|
||||||
@ -1125,12 +1129,21 @@ async function beginInvoke(msg, ws) {
|
|||||||
async function click_element(element, type = "click") {
|
async function click_element(element, type = "click") {
|
||||||
try {
|
try {
|
||||||
if (type == "loopClickEvery") {
|
if (type == "loopClickEvery") {
|
||||||
await driver
|
if (process.platform === "darwin") {
|
||||||
|
await driver
|
||||||
|
.actions()
|
||||||
|
.keyDown(Key.COMMAND)
|
||||||
|
.click(element)
|
||||||
|
.keyUp(Key.COMMAND)
|
||||||
|
.perform();
|
||||||
|
} else {
|
||||||
|
await driver
|
||||||
.actions()
|
.actions()
|
||||||
.keyDown(Key.CONTROL)
|
.keyDown(Key.CONTROL)
|
||||||
.click(element)
|
.click(element)
|
||||||
.keyUp(Key.CONTROL)
|
.keyUp(Key.CONTROL)
|
||||||
.perform();
|
.perform();
|
||||||
|
}
|
||||||
} else if (type.includes("point(")) {
|
} else if (type.includes("point(")) {
|
||||||
//point(10, 20)表示点击坐标为(10, 20)的位置
|
//point(10, 20)表示点击坐标为(10, 20)的位置
|
||||||
let point = type.substring(6, type.length - 1).split(",");
|
let point = type.substring(6, type.length - 1).split(",");
|
||||||
|
1
ElectronJS/tasks/322.json
Normal file
1
ElectronJS/tasks/322.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"id":322,"name":"京东全球版-专业的综合网上购物商城","url":"https://www.jd.com","links":"https://www.jd.com","create_time":"2024-04-22 08:13:15","update_time":"2024-04-22 08:13:33","version":"0.6.2","saveThreshold":10,"quitWaitTime":60,"environment":0,"maximizeWindow":0,"maxViewLength":15,"recordLog":1,"outputFormat":"csv","saveName":"current_time","dataWriteMode":1,"inputExcel":"","startFromExit":0,"pauseKey":"p","containJudge":false,"browser":"chrome","removeDuplicate":0,"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":1,"option":8,"title":"循环点击每个元素","sequence":[3],"isInLoop":false,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"/html/body/div[5]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div/a","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"waitElement":"","waitElementTime":10,"waitElementIframeIndex":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"loopType":1,"pathList":"","code":"","waitTime":0,"exitCount":0,"exitElement":"//body","historyWait":2,"breakMode":0,"breakCode":"","breakCodeWaitTime":0,"skipCount":0,"allXPaths":""}},{"id":3,"index":3,"parentId":2,"type":0,"option":2,"title":"点击元素","sequence":[],"isInLoop":true,"position":0,"parameters":{"history":4,"tabIndex":-1,"useLoop":true,"xpath":"","iframe":false,"wait":2,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"waitElement":"","waitElementTime":10,"waitElementIframeIndex":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"clickWay":0,"newTab":1,"maxWaitTime":10,"params":[],"alertHandleType":0,"downloadWaitTime":3600,"allXPaths":""}}]}
|
2
ExecuteStage/.vscode/launch.json
vendored
2
ExecuteStage/.vscode/launch.json
vendored
@ -12,7 +12,7 @@
|
|||||||
"justMyCode": false,
|
"justMyCode": false,
|
||||||
// "args": ["--ids", "[7]", "--read_type", "remote", "--headless", "0"]
|
// "args": ["--ids", "[7]", "--read_type", "remote", "--headless", "0"]
|
||||||
// "args": ["--ids", "[9]", "--read_type", "remote", "--headless", "0", "--saved_file_name", "YOUTUBE"]
|
// "args": ["--ids", "[9]", "--read_type", "remote", "--headless", "0", "--saved_file_name", "YOUTUBE"]
|
||||||
"args": ["--ids", "[83]", "--headless", "0", "--user_data", "0", "--keyboard", "0",
|
"args": ["--ids", "[13]", "--headless", "0", "--user_data", "0", "--keyboard", "0",
|
||||||
"--read_type", "remote"]
|
"--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"
|
// "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"
|
||||||
}
|
}
|
||||||
|
@ -1721,8 +1721,11 @@ class BrowserThread(Thread):
|
|||||||
try:
|
try:
|
||||||
actions = ActionChains(self.browser) # 实例化一个action对象
|
actions = ActionChains(self.browser) # 实例化一个action对象
|
||||||
if newTab == 1: # 在新标签页打开
|
if newTab == 1: # 在新标签页打开
|
||||||
# Ctrl + Click
|
if sys.platform == "darwin": # Mac
|
||||||
actions.key_down(Keys.CONTROL).click(element).key_up(Keys.CONTROL).perform()
|
actions.key_down(Keys.COMMAND).click(element).key_up(Keys.COMMAND).perform()
|
||||||
|
else:
|
||||||
|
# Ctrl + Click
|
||||||
|
actions.key_down(Keys.CONTROL).click(element).key_up(Keys.CONTROL).perform()
|
||||||
else:
|
else:
|
||||||
actions.click(element).perform()
|
actions.click(element).perform()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -1 +1 @@
|
|||||||
{"language":"zh"}
|
{"language":"en"}
|
Loading…
x
Reference in New Issue
Block a user