0

Unable to Access the password by name tried this from a stackoverflow answer but still not working

<input type="password" class="required valid" style="font-size: 14px; margin-top: 1em; padding: 0.3em !important; width: 100% !important; border-radius: 3px;" placeholder="password" name="password">

Code trials:

WebDriverWait(driver, 10).until(
    EC.presence_of_element_located(
        (By.NAME, passwordId))
).click()

driver.find_element_by_name(passwordId).send_keys(password)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
A S K VYAS
  • 3
  • 1
  • 6

1 Answers1

0

Instead of presence_of_element_located() you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using NAME:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.NAME, "password"))).click()
    
  • Using CSS_SELECTOR:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='password'][placeholder='password']"))).click()
    
  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='password' and @placeholder='password']"))).click()
    
  • 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
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.NAME, "password"))).click() File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) – A S K VYAS Jan 30 '21 at 04:04