This commit is contained in:
daniel.rodrigues 2025-11-17 11:34:22 -03:00
parent fb3e222c3e
commit baf28b43db

View File

@ -3,7 +3,7 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.service import Service # from selenium.webdriver.chrome.service import Service # Usado apenas para Linux/Docker
from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.options import Options
import time import time
import os import os
@ -15,8 +15,8 @@ from datetime import datetime, timedelta
import json import json
# Configuração da data # Configuração da data
USE_MANUAL_DATE = False # False = usar dia anterior automaticamente; True = usar MANUAL_DATE_STR USE_MANUAL_DATE = True # False = usar dia anterior automaticamente; True = usar MANUAL_DATE_STR
MANUAL_DATE_STR = "15102025" # Formato DDMMAAAA, usado quando USE_MANUAL_DATE=True MANUAL_DATE_STR = "16112025" # Formato DDMMAAAA, usado quando USE_MANUAL_DATE=True
# Configuração de intervalo de datas (execução dia por dia) # Configuração de intervalo de datas (execução dia por dia)
USE_DATE_RANGE = False # True = usar intervalo de datas; False = usar USE_MANUAL_DATE USE_DATE_RANGE = False # True = usar intervalo de datas; False = usar USE_MANUAL_DATE
@ -174,17 +174,17 @@ def main():
# Usar o binário do Chromium instalado no sistema (para Kubernetes/Docker) # Usar o binário do Chromium instalado no sistema (para Kubernetes/Docker)
# Comentar a linha abaixo se estiver rodando localmente no Windows # Comentar a linha abaixo se estiver rodando localmente no Windows
chrome_options.binary_location = '/usr/bin/chromium' # chrome_options.binary_location = '/usr/bin/chromium'
# Inicializar o driver do Chrome # Inicializar o driver do Chrome
print("Iniciando o navegador...") print("Iniciando o navegador...")
# Criar o service apontando para o chromedriver do sistema (Kubernetes/Docker) # Criar o service apontando para o chromedriver do sistema (Kubernetes/Docker)
# Comentar a linha abaixo se estiver rodando localmente no Windows # Comentar a linha abaixo se estiver rodando localmente no Windows
service = Service('/usr/bin/chromedriver') # service = Service('/usr/bin/chromedriver')
driver = webdriver.Chrome(service=service, options=chrome_options) # driver = webdriver.Chrome(service=service, options=chrome_options)
# Para rodar localmente no Windows, use: # Para rodar localmente no Windows, use:
# driver = webdriver.Chrome(options=chrome_options) driver = webdriver.Chrome(options=chrome_options)
try: try:
# Acessar a URL # Acessar a URL