Selaa lähdekoodia

MacOS

pull/356/head
Naibo_Mac_M2 5 kuukautta sitten
vanhempi
commit
960cf74de1
6 muutettua tiedostoa jossa 23 lisäystä ja 6 poistoa
  1. BIN
      ElectronJS/EasySpider_zh.crx
  2. +15
    -2
      ElectronJS/main.js
  3. +1
    -0
      ElectronJS/tasks/322.json
  4. +1
    -1
      ExecuteStage/.vscode/launch.json
  5. +5
    -2
      ExecuteStage/easyspider_executestage.py
  6. +1
    -1
      Extension/manifest_v3/src/content-scripts/config.json

BIN
ElectronJS/EasySpider_zh.crx Näytä tiedosto


+ 15
- 2
ElectronJS/main.js Näytä tiedosto

@ -654,7 +654,11 @@ async function beginInvoke(msg, ws) {
if (parameters.clickWay == 2){ //双击
await click_element(element, "double");
} else {
await click_element(element); //单击
if (parameters.newTab == 1){
await click_element(element, "loopClickEvery"); //新标签页打开
} else {
await click_element(element); //单击
}
}
}
let alertHandleType = parameters.alertHandleType;
@ -1125,12 +1129,21 @@ async function beginInvoke(msg, ws) {
async function click_element(element, type = "click") {
try {
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()
.keyDown(Key.CONTROL)
.click(element)
.keyUp(Key.CONTROL)
.perform();
}
} else if (type.includes("point(")) {
//point(10, 20)表示点击坐标为(10, 20)的位置
let point = type.substring(6, type.length - 1).split(",");

+ 1
- 0
ElectronJS/tasks/322.json Näytä tiedosto

@ -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":""}}]}

+ 1
- 1
ExecuteStage/.vscode/launch.json Näytä tiedosto

@ -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", "[83]", "--headless", "0", "--user_data", "0", "--keyboard", "0",
"args": ["--ids", "[13]", "--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"
}

+ 5
- 2
ExecuteStage/easyspider_executestage.py Näytä tiedosto

@ -1721,8 +1721,11 @@ class BrowserThread(Thread):
try:
actions = ActionChains(self.browser) # 实例化一个action对象
if newTab == 1: # 在新标签页打开
# Ctrl + Click
actions.key_down(Keys.CONTROL).click(element).key_up(Keys.CONTROL).perform()
if sys.platform == "darwin": # Mac
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:
actions.click(element).perform()
except Exception as e:

+ 1
- 1
Extension/manifest_v3/src/content-scripts/config.json Näytä tiedosto

@ -1 +1 @@
{"language":"zh"}
{"language":"en"}

Ladataan…
Peruuta
Tallenna