# /var/www/html/mysite/test_selenium.py
from seleniumbase import SB
import os

os.environ["DISPLAY"] = ":99"
os.environ["HOME"] = "/var/www/html/melhorprecodf.com.br/chrome_temp"
print("Iniciando teste...")
try:
    with SB(
        uc=True,
        headless=True,
        #no_driver_reuse=True,  # Força nova sessão
        chromium_arg="--no-sandbox --disable-gpu"  # Argumentos para servidor
    ) as driver:
        print("Driver iniciado")
        driver.open("https://www.google.com")
        print("Página aberta")
        print(driver.get_title())
except Exception as e:
    print(f"Erro: {str(e)}")
