[Python] cant find element with Selenium

Discussão em 'Python' iniciado por Stack, Agosto 6, 2025.

  1. Stack

    Stack Membro Participativo

    [​IMG]

    I'm getting the following

    An error occurred: Message:
    Stacktrace:
    RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
    WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:199:5
    NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:552:5
    dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:136:16


    I'm new to Selenium. My first question is the references to chrome. I'm using firefox is this error message typical?

    My real question is how do I retrieve this button?

    I've tried many ways to select the element e.g.

    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC

    driver = webdriver.Firefox()

    link = 'https://ennexos.sunnyportal.com/login?next=%2Fdashboard%2Finitialize'
    driver.get(link)

    try:
    # Wait for the login button to be present
    login_button = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.CSS_SELECTOR, "[data-testid='button-primary']"))
    )

    print("found login button!")


    except Exception as e:
    print(f"An error occurred: {e}")

    finally:
    driver.quit()

    Continue reading...

Compartilhe esta Página