Selenium cannot find element by name or id (Python)

I am trying to automate logging into a website using selenium, but I am getting “no such element message” error. Here is my code, with the link to the website included:

from selenium import webdriver
import time
import datetime

driver = webdriver.Chrome("C:\Users\Family\Downloads\chromedriver_win32\chromedriver.exe")

login_button = driver.find_element_by_id("i0116")
login_button.send_keys("[email protected]")

And here is the element I am trying to access with my code:

<input type="email" name="loginfmt" id="i0116" maxlength="113" lang="en" class="form-control ltr_override input ext-input text-box ext-text-box" aria-required="true" data-bind="
                    externalCss: {
                        'input': true,
                        'text-box': true,
                        'has-error': usernameTextbox.error },
                    ariaLabel: tenantBranding.UserIdLabel || str['CT_PWD_STR_Username_AriaLabel'],
                    ariaDescribedBy: 'loginHeader' + (pageDescription &amp;&amp; !svr.fHideLoginDesc ? ' loginDescription' : ''),
                    textInput: usernameTextbox.value,
                    hasFocusEx: usernameTextbox.focused,
                    placeholder: $placeholderText" aria-label="Enter your TDSB email address here, then click Next" aria-describedby="loginHeader" placeholder="Enter your TDSB email address here, then click Next">

From other answers I understand that you have to use driver.find_element_by_css_selector() and driver.switch_to.frame(), but if you look at the full hypertext of the website, the first frame to go into is a “div” tag without any attributes. It is however the only “div” tag alongside two “script” tags. I need the correct code to go into the frame, or another method to automate logging in.


It seems synchronization Issue. Induce WebDriverWait() and wait for element_to_be_clickable()

login_button =WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.ID,"i0116")))
login_button.send_keys("[email protected]")

You need to import following libraries.

from import WebDriverWait
from import expected_conditions as EC
from import By

login_button =WebDriverWait(driver,20).until(EC.element_to_be_clickable((By.NAME,"loginfmt")))