diff --git a/ElectronJS/EasySpider_zh.crx b/ElectronJS/EasySpider_zh.crx new file mode 100644 index 0000000..cea8078 Binary files /dev/null and b/ElectronJS/EasySpider_zh.crx differ diff --git a/ElectronJS/main.js b/ElectronJS/main.js index 210e0e6..fc16e69 100644 --- a/ElectronJS/main.js +++ b/ElectronJS/main.js @@ -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(","); diff --git a/ElectronJS/tasks/322.json b/ElectronJS/tasks/322.json new file mode 100644 index 0000000..8621ece --- /dev/null +++ b/ElectronJS/tasks/322.json @@ -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":""}}]} \ No newline at end of file diff --git a/ExecuteStage/.vscode/launch.json b/ExecuteStage/.vscode/launch.json index 0759921..f237b43 100644 --- a/ExecuteStage/.vscode/launch.json +++ b/ExecuteStage/.vscode/launch.json @@ -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" } diff --git a/ExecuteStage/easyspider_executestage.py b/ExecuteStage/easyspider_executestage.py index 7e8464f..5fdbe30 100644 --- a/ExecuteStage/easyspider_executestage.py +++ b/ExecuteStage/easyspider_executestage.py @@ -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: diff --git a/Extension/manifest_v3/src/content-scripts/config.json b/Extension/manifest_v3/src/content-scripts/config.json index a2e684c..3706a6d 100644 --- a/Extension/manifest_v3/src/content-scripts/config.json +++ b/Extension/manifest_v3/src/content-scripts/config.json @@ -1 +1 @@ -{"language":"zh"} \ No newline at end of file +{"language":"en"} \ No newline at end of file