[Python] Cannot access elements in a pop-up window to close it

Discussão em 'Python' iniciado por Stack, Fevereiro 3, 2025.

  1. Stack

    Stack Membro Participativo

    Disclaimer - I'm not even remotely fluent with HTML, so please bear with me...

    I'm automating a weekly data download process and one website (ChargePoint) displays some sort of pop-up if there is a charging sessions active at the moment. I need to close that pop-up in order to get to the main window and activate the data download. But I cannot figure out how to close the pop-up because trying to locate any element in the pop-up window fails.

    I cannot figure out how to obtain the HTML to paste here, so here's a screenshot of the offending pop-up window and the corresponding HTML:

    [​IMG]

    I've tried locating the "Close" button using XPATH and CLASSS_NAME; both methods fail:

    close_btn = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,
    "//*[contains(text(), 'Close')]")))


    and

    close_btn = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CLASS_NAME,
    "sc-iHmpnF knKEkw modal-close")))


    What am I doing wrong? And if it helps, how do I get the actual HTML code to paste into this post?

    Continue reading...

Compartilhe esta Página