0

Using selenium along with python 3.6, need to make a basic script that lets you log into your google acc using selenium. Works fine till you have to enter your password after which it can't find the element in the page. This is my current attempt

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

print("Enter email")
e = input()
print("Enter pass")
p = input()
driver = webdriver.Firefox()
wait = WebDriverWait(driver, 10)
driver.get("https://keep.google.com/u/0/")
assert "Sign in" in driver.title
email = driver.find_element_by_id("identifierId")
email.clear()
email.send_keys(e)
submit = driver.find_element_by_id("identifierNext")
submit.click()
paswd = WebDriverWait(driver, 5).until(* 
if paswd == True:
    print("yay")
else:
    print("false")
paswd = driver.find_element_by_xpath("//input[@type='password']")
paswd.send_keys(p)
submit = driver.find_element_by_class_name("CwaK9")
submit.click()

*EC.presence_of_element_located((By.XPATH, "//input[@type='password']")))

*Can't format code for the part above so it's continued after the block. Any help would be appreciated

Arjun
  • 19
  • 4

1 Answers1

0

Use different expected condition wait. Instead of presence_of_element_located use element_to_be_clickable.

paswd = WebDriverWait(driver, 5).until(EC. element_to_be_clickable((By.XPATH, "//input[@type='password']")))
Monika
  • 714
  • 1
  • 4
  • 10