[Python] Can't find HBO Max sign-in, "unable to locate element" error

Discussão em 'Python' iniciado por Stack, Novembro 29, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to make a automation that logs into https://auth.hbomax.com/login, however I keep getting the below error as the code can't locate the sign-in element.

    selenium.common.exceptions.NoSuchElementException: Message: no such element:
    Unable to locate element: {"method":"css selector","selector":"[id="sign-in-email-input"]"}


    Below is the code:

    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.by import By

    def get_driver():
    #set options to make browsing easier
    options = webdriver.ChromeOptions()
    options.add_experimental_option("detach", True)
    options.add_argument("disable-infobars")
    options.add_argument("start-maximized")
    options.add_argument("disable-dev-shm-usag")
    options.add_argument("no-sandbox")
    options.add_experimental_option("escludeSwitches", ["enable-automation"])
    options.add_argument("disable-blink-features=AutomationControlled")

    driver = webdriver.Chrome()
    driver.get("https://auth.hbomax.com/login")
    return driver

    def main():
    driver = get_driver()
    wait = WebDriverWait(driver, 10)

    #accepts cookie
    wait.until(EC.presence_of_element_located((By.XPATH, "/html/body/div[1]/div[1]/div/div/div/section/div/button[1]/div/div/span"))).click()

    #unable to locate element
    wait.until(EC.presence_of_all_elements_located((By.XPATH, "//*[@id='sign-in-email-input']")))


    Other paths I tried but still couldn't locate, I checked them all with driver.find_element command:

    By.ID, "sign-in-email-input"
    by.ID, "sign-in-email"
    by.XPATH, "//*[@id='sign-in-email']/div"
    by.XPATH, "//*[@id='sign-in-email-input']"
    by.XPATH, "/html/body/div[1]/div[2]/div[1]/div/main/div[2]/gi-login//gi-sign-in-flow/gi-sign-in-email//gi-track-analytics-events/div/gi-form/div/form/div[2]/div/gi-form-input/div/input"


    Below is the HTML code of the sign-in:

    <label id="sign-in-email-label" for="sign-in-email-input">Endereço de e-mail</label>
    <gi-form-input id="sign-in-email" class="hydrated">
    <div role="region" class="text-input-wrapper" dir="ltr">
    <input class="input" id="sign-in-email-input" type="email"
    name="email" dir="ltr" autocomplete="email"
    required data-testid="giweb.general.forms.emailInput.form-field"
    data-click-element-subtype="EMAIL_INPUT"
    data-click-element-type="FIELD_INPUT" aria-invalid="false"
    aria-required="true" aria-describedby="sign-in-email-error sign-in-email-hint">
    </div>
    </gi-form-input>

    Continue reading...

Compartilhe esta Página