0
<input class="inputDefault-_djjkz input-cIJ7To" name="password" type="password" placeholder="" aria-label="Password" autocomplete="off" maxlength="999" spellcheck="false" value="">```

^this is the HTML ive been trying something like

login = driver.find_element_by_xpath(".//*[@class='inputDefault-_djjkz input-cIJ7To']/div/input").click()

thanks for any help

DebanjanB
  • 118,661
  • 30
  • 168
  • 217

2 Answers2

0

You can use the following code :

driver.find_element_by_xpath("//input[@class='inputDefault-_djjkz input-cIJ7To']")
0

To identify the clickable element you can use either of the following Locator Strategies:

  • Using css_selector:

    element = driver.find_element(By.CSS_SELECTOR, "input[name='password'][aria-label='Password']")
    
  • Using xpath:

    element = driver.find_element(By.XPATH, "//input[@name='password' and @aria-label='Password']")
    

Ideally, to identify the element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='password'][aria-label='Password']")))
    
  • Using XPATH:

    element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='password' and @aria-label='Password']")))
    
  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
DebanjanB
  • 118,661
  • 30
  • 168
  • 217