I am recently working through examples in Automate the Boring Stuff in Python, and came across this example which I have some issues with. In this exercise, I tried to log in to Yahoo Mail using Selenium on the Chrome browser. The code does not produce any error and successfully prints the last line, however, it fails to click on the submit button which leaves me stuck at the login page despite successfully filling up the password. However, if I click on the login button manually, I can login successfully.
I have tried both passwordelem.submit() and passwordsubmitbtn.click() but neither works. I have also tried changing the user-agent in chrome but to no avail.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
browser = webdriver.Chrome()
browser.get('https://login.yahoo.com?.src=ym&.lang=en-US&.intl=us&.done=https%3A%2F%2Fmail.yahoo.com%2Fd')
wait = WebDriverWait(browser, 10)
emailelem = wait.until(EC.presence_of_element_located((By.ID,'login-username')))
emailelem.send_keys('xxxxxx@yahoo.com')
wait.until(EC.presence_of_element_located((By.ID,'login-signin')))
emailelem.submit()
passwordelem = wait.until(EC.presence_of_element_located((By.ID,'login-passwd')))
passwordelem.send_keys('xxxxxx')
##passwordelem.submit()
passwordsubmitbtn = wait.until(EC.element_to_be_clickable((By.ID,'login-signin')))
passwordsubmitbtn.click()
print ('Done')

