[Python] Selenium can't click visible <button> with text "Download All"

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

  1. Stack

    Stack Membro Participativo

    I'm trying to click a "Download All" button using Selenium in Python. Here's the relevant HTML from inspect:

    <button title="" type="button" class="bds-button variant-primary" data-title="">Download All</button>


    I've tried literally everything I can think of:

    XPath:

    driver.find_element(By.XPATH, "//button[text()='Download All']").click()


    CSS Selector:

    driver.find_element(By.CSS_SELECTOR, "button.bds-button.variant-primary").click()


    Looping through all buttons:

    buttons = driver.find_elements(By.TAG_NAME, "button")
    for b in buttons:
    print(f'Text: "{b.text.strip()}" | Class: {b.get_attribute("class")}')
    if b.text.strip() == "Download All":
    b.click()


    Explicit waits:

    WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.XPATH, "//button[text()='Download All']"))
    ).click()


    Scrolling into view:

    driver.execute_script("arguments[0].scrollIntoView(true);", button)


    Checking for iframes using:

    print(driver.find_elements(By.TAG_NAME, "iframe"))


    Checking for shadow DOMs, but I don’t see any shadow roots.

    What I know:


    • The button is visible in the browser.


    • The button is not inside an iframe.


    • The button does not appear to be in a shadow DOM.


    • The page is fully loaded before interaction.


    • There's no id attribute on the button.

    Continue reading...

Compartilhe esta Página