Update wehago matching logic and exclude reports

This commit is contained in:
b17301
2026-07-03 09:07:04 +09:00
parent a09190ecd3
commit da073ad6ef
62 changed files with 36940 additions and 1554 deletions
+37
View File
@@ -0,0 +1,37 @@
from __future__ import annotations
import os
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
options = Options()
options.add_experimental_option("debuggerAddress", os.environ.get("WEHAGO_CHROME_DEBUGGER_ADDRESS", "127.0.0.1:9225"))
driver = webdriver.Chrome(options=options)
try:
webdriver.ActionChains(driver).send_keys(Keys.ESCAPE).perform()
clicked = driver.execute_script(
"""
const width = window.innerWidth;
const candidates = Array.from(document.querySelectorAll('button, a, div, span'))
.filter(el => (el.textContent || '').trim() === '조회')
.filter(el => {
const r = el.getBoundingClientRect();
const style = getComputedStyle(el);
return r.width > 0 && r.height > 0 && r.top >= 70 && r.top <= 240
&& r.left > width * 0.6 && style.display !== 'none' && style.visibility !== 'hidden';
})
.sort((a, b) => b.getBoundingClientRect().left - a.getBoundingClientRect().left);
if (!candidates.length) return false;
candidates[0].click();
return true;
"""
)
print(f"query_clicked={bool(clicked)}", flush=True)
time.sleep(4)
finally:
driver.quit()