[Python] Selenium can't close notification popup on https://www.e-crvsp.sp.gov.br/

Discussão em 'Python' iniciado por Stack, Maio 9, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to automate some tasks using Selenium on the following website: https://www.e-crvsp.sp.gov.br/

    However, I'm stuck at the very beginning: there's an initial notification popup, and I can't seem to close it programmatically.

    I've tried multiple solutions with ChatGPT, including:

    Increasing wait time

    Using different selectors (XPath, CSS)

    Executing JavaScript

    Adding delays and retries

    None of them worked so far. I’m starting to believe the website may have mechanisms to detect automation tools like Selenium and block certain actions.

    Here's a simplified version of my test code, which just checks if the WebDriver works:

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager

    def test_chromedriver():
    try:
    options = webdriver.ChromeOptions()
    options.add_argument("--headless") # Optional: run Chrome in headless mode

    driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
    driver.get("https://www.google.com")

    if "Google" in driver.title:
    print("Chromedriver is working correctly!")
    else:
    print("There might be an issue with Chromedriver.")

    driver.quit()
    except Exception as e:
    print(f"Error starting Chromedriver: {str(e)}")

    if __name__ == "__main__":
    test_chromedriver()


    Any suggestions or insights on how to bypass or properly interact with that popup on the e-CRVsp site are welcome. Thank you in advance!

    Continue reading...

Compartilhe esta Página