mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-20 04:39:57 +08:00
Bug fix
This commit is contained in:
parent
d13cd29fac
commit
7511de816c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
.temp_to_pub/EasySpider_windows_x64/tasks/296.json
Normal file
1
.temp_to_pub/EasySpider_windows_x64/tasks/296.json
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
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", "[58]", "--headless", "0", "--user_data", "0", "--keyboard", "0",
|
"args": ["--ids", "[1]", "--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"
|
||||||
}
|
}
|
||||||
|
@ -1115,10 +1115,18 @@ class BrowserThread(Thread):
|
|||||||
if node["parameters"]["exitCount"] == 0:
|
if node["parameters"]["exitCount"] == 0:
|
||||||
# newBodyText = self.browser.find_element(By.XPATH, node["parameters"]["exitElement"], iframe=node["parameters"]["iframe"]).text
|
# newBodyText = self.browser.find_element(By.XPATH, node["parameters"]["exitElement"], iframe=node["parameters"]["iframe"]).text
|
||||||
# 用find_elements获取所有匹配到的文本
|
# 用find_elements获取所有匹配到的文本
|
||||||
|
try:
|
||||||
exitElements = self.browser.find_elements(By.XPATH, node["parameters"]["exitElement"], iframe=node["parameters"]["iframe"])
|
exitElements = self.browser.find_elements(By.XPATH, node["parameters"]["exitElement"], iframe=node["parameters"]["iframe"])
|
||||||
newBodyText = ""
|
newBodyText = ""
|
||||||
for exitElement in exitElements:
|
for exitElement in exitElements:
|
||||||
newBodyText += exitElement.text
|
newBodyText += exitElement.text
|
||||||
|
except Exception as e:
|
||||||
|
self.print_and_log(f"设定的退出循环元素:{node['parameters']['exitElement']}的文本无法获取,本次循环将不再检测元素文本是否变化,将会继续执行,为解决此问题,您可以修改检测元素文本不变的元素为其他元素,或者将循环次数设定为固定次数大于0的值。")
|
||||||
|
self.print_and_log(f"The text of the exit loop element set: {node['parameters']['exitElement']} cannot be obtained, this loop will no longer check whether the text of the element has changed, and will continue to execute. To solve this problem, you can modify the element whose text does not change to other elements, or set the number of loops to a fixed number greater than 0.")
|
||||||
|
self.print_and_log(e)
|
||||||
|
exitElements = []
|
||||||
|
# newBodyText为随机文本,保证一直执行
|
||||||
|
newBodyText = str(random.random())
|
||||||
if node["parameters"]["iframe"]: # 如果标记了iframe
|
if node["parameters"]["iframe"]: # 如果标记了iframe
|
||||||
iframes = self.browser.find_elements(
|
iframes = self.browser.find_elements(
|
||||||
By.CSS_SELECTOR, "iframe", iframe=False)
|
By.CSS_SELECTOR, "iframe", iframe=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user