feat: remove outdated bank expenses, maximize browser window, add ESC key sequences for navigation, and update modal button selectors
This commit is contained in:
@@ -400,9 +400,9 @@ class SigaDespesasAutomation:
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
"Chrome/124.0.0.0 Safari/537.36"
|
||||
),
|
||||
args=["--disable-blink-features=AutomationControlled"],
|
||||
args=["--disable-blink-features=AutomationControlled", "--start-maximized"],
|
||||
ignore_default_args=["--enable-automation"],
|
||||
viewport={"width": 1366, "height": 768},
|
||||
#viewport={"width": 1366, "height": 768},
|
||||
locale="pt-BR",
|
||||
timezone_id="America/Cuiaba",
|
||||
)
|
||||
@@ -729,6 +729,12 @@ class SigaDespesasAutomation:
|
||||
press_enter_for_ajax=True,
|
||||
)
|
||||
|
||||
# Faça com que seja apertado a tecla ESC
|
||||
await page.keyboard.press("Escape", delay=400)
|
||||
await human_delay(300, 600)
|
||||
await page.keyboard.press("Escape", delay=500)
|
||||
await human_delay(300, 600)
|
||||
|
||||
# 7. Validação do Histórico (Rateio)
|
||||
logger.info(f"7️⃣ Validando Histórico...")
|
||||
historico_select = page.locator("#f_historico_debito").first
|
||||
@@ -738,6 +744,12 @@ class SigaDespesasAutomation:
|
||||
if "12 - DESP.BANC" in hist_text:
|
||||
logger.info(f"7️⃣ Histórico de Rateio Validado: '{hist_text.strip()}'")
|
||||
|
||||
# Faça com que seja apertado a tecla ESC
|
||||
await page.keyboard.press("Escape", delay=400)
|
||||
await human_delay(300, 600)
|
||||
await page.keyboard.press("Escape", delay=500)
|
||||
await human_delay(300, 600)
|
||||
|
||||
# 8. Complemento (Rateio)
|
||||
logger.info(f"8️⃣ Preenchendo Complemento (Rateio): '{expense.complemento}'...")
|
||||
complemento_input = page.locator("#f_complemento2").first
|
||||
@@ -808,7 +820,7 @@ class SigaDespesasAutomation:
|
||||
logger.info("ℹ️ Modal 'Sim' não foi solicitada ou fechou automaticamente.")
|
||||
|
||||
# 2. Confirmação de mensagem de sucesso ("OK")
|
||||
ok_btn = page.locator("button:has-text('OK'), button.btn-primary:has-text('OK'), button[data-bb-handler='ok'], .modal-footer button:has-text('OK')").first
|
||||
ok_btn = page.locator("button:has-text('Ok'), button.btn-primary:has-text('Ok'), button[data-bb-handler='botao'], .modal-footer button:has-text('Ok')").first
|
||||
try:
|
||||
await ok_btn.wait_for(state="visible", timeout=6000)
|
||||
logger.info("ℹ️ Modal de sucesso detectada. Clicando em 'OK'...")
|
||||
|
||||
Reference in New Issue
Block a user