I am trying to sign into a website (
CodePudding user response:
Try adding a wait for the element to be clickable, as following:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 20)
wait.until(EC.element_to_be_clickable((By.NAME, "email"))).send_keys(username)
CodePudding user response:
Your problem is related to email validation. What I discovered.
- If you enter the password first, then everything works.
- If you leave the email input field, then everything will also work
So, one of the possible solutions to send enter after entering email
username = '[email protected]'
password = 'password123'
driver = webdriver.Chrome(ChromeDriverManager().install())
try:
driver.get('https://myaccount.play-cricket.com/')
email_input = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.NAME, "email")))
email_input.send_keys(username)
email_input.send_keys(Keys.ENTER)
password_input = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.NAME, "password")))
password_input.send_keys(password)
finally:
driver.quit()
CodePudding user response:
Try This
wait.until(EC.element_to_be_clickable((By.NAME, 'password')))
driver.find_element(By.NAME, 'password').send_keys(password)
or Try this time.sleep(5) driver.find_element(By.NAME, 'password').send_keys(password)