feat: remove outdated bank expenses, maximize browser window, add ESC key sequences for navigation, and update modal button selectors

This commit is contained in:
2026-08-10 01:44:55 -04:00
parent 4c8ea6dce8
commit 437d70ac1c
2 changed files with 15 additions and 5 deletions

View File

@@ -1,6 +1,4 @@
Data,Lançamento,Documento,Débito (R$) Data,Lançamento,Documento,Débito (R$)
02/07/2026,TARIFA BANCARIA LIQUIDACAO QRCODE PIX,4,"4,82"
03/07/2026,TARIFA BANCARIA LIQUIDACAO QRCODE PIX,2,"1,80"
06/07/2026,TARIFA BANCARIA LIQUIDACAO QRCODE PIX,1,"0,90" 06/07/2026,TARIFA BANCARIA LIQUIDACAO QRCODE PIX,1,"0,90"
07/07/2026,TARIFA BANCARIA LIQUIDACAO QRCODE PIX,1,"0,90" 07/07/2026,TARIFA BANCARIA LIQUIDACAO QRCODE PIX,1,"0,90"
08/07/2026,TARIFA BANCARIA LIQUIDACAO QRCODE PIX,1,"0,90" 08/07/2026,TARIFA BANCARIA LIQUIDACAO QRCODE PIX,1,"0,90"
1 Data Lançamento Documento Débito (R$)
02/07/2026 TARIFA BANCARIA LIQUIDACAO QRCODE PIX 4 4,82
03/07/2026 TARIFA BANCARIA LIQUIDACAO QRCODE PIX 2 1,80
2 06/07/2026 TARIFA BANCARIA LIQUIDACAO QRCODE PIX 1 0,90
3 07/07/2026 TARIFA BANCARIA LIQUIDACAO QRCODE PIX 1 0,90
4 08/07/2026 TARIFA BANCARIA LIQUIDACAO QRCODE PIX 1 0,90

View File

@@ -400,9 +400,9 @@ class SigaDespesasAutomation:
"AppleWebKit/537.36 (KHTML, like Gecko) " "AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/124.0.0.0 Safari/537.36" "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"], ignore_default_args=["--enable-automation"],
viewport={"width": 1366, "height": 768}, #viewport={"width": 1366, "height": 768},
locale="pt-BR", locale="pt-BR",
timezone_id="America/Cuiaba", timezone_id="America/Cuiaba",
) )
@@ -729,6 +729,12 @@ class SigaDespesasAutomation:
press_enter_for_ajax=True, 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) # 7. Validação do Histórico (Rateio)
logger.info(f"7️⃣ Validando Histórico...") logger.info(f"7️⃣ Validando Histórico...")
historico_select = page.locator("#f_historico_debito").first historico_select = page.locator("#f_historico_debito").first
@@ -738,6 +744,12 @@ class SigaDespesasAutomation:
if "12 - DESP.BANC" in hist_text: if "12 - DESP.BANC" in hist_text:
logger.info(f"7️⃣ Histórico de Rateio Validado: '{hist_text.strip()}'") 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) # 8. Complemento (Rateio)
logger.info(f"8️⃣ Preenchendo Complemento (Rateio): '{expense.complemento}'...") logger.info(f"8️⃣ Preenchendo Complemento (Rateio): '{expense.complemento}'...")
complemento_input = page.locator("#f_complemento2").first complemento_input = page.locator("#f_complemento2").first
@@ -808,7 +820,7 @@ class SigaDespesasAutomation:
logger.info("ℹ️ Modal 'Sim' não foi solicitada ou fechou automaticamente.") logger.info("ℹ️ Modal 'Sim' não foi solicitada ou fechou automaticamente.")
# 2. Confirmação de mensagem de sucesso ("OK") # 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: try:
await ok_btn.wait_for(state="visible", timeout=6000) await ok_btn.wait_for(state="visible", timeout=6000)
logger.info("ℹ️ Modal de sucesso detectada. Clicando em 'OK'...") logger.info("ℹ️ Modal de sucesso detectada. Clicando em 'OK'...")