I am having trouble finding the Login ID and Password elements on this webpage. I want to locate these elements so I can input a username ID and password so as to automatically log in. However, I am getting a NoSuchElementException
. I have tried to find the element By.ID, By.CSS_SELECTOR, By.XPATH, all with the same error. Maybe the element is nested inside another element?
This is my stopping point where I tried finding the element by CSS_SELECTOR but I have tried XPATH and ID.
Attempt #1
from selenium import webdriver
from selenium.webdriver.edge.service import Service
from selenium.webdriver.common.by import By
service = Service(executable_path='../chromedriver.exe')
driver = webdriver.Chrome(service = service)
driver.get('https://advisorservices.schwab.com/')
driver.implicitly_wait(2)
user_id = driver.find_element(By.ID, 'loginIdInput')
user_id.send_keys(web_username)
password = driver.find_element(By.ID, 'passwordInput')
password.send_keys(web_password)
logon = driver.find_element(By.ID, 'continueBtnText')
logon.click()
Attempt 2
service = Service(executable_path='../chromedriver.exe')
driver = webdriver.Chrome(service = service)
driver.get('https://advisorservices.schwab.com/')
driver.implicitly_wait(2)
user_id = driver.find_element(By.CSS_SELECTOR, '#user-name')
user_id.send_keys(web_username)
password = driver.find_element(By.CSS_SELECTOR, '#passwordInput')
password.send_keys(web_password)
logon = driver.find_element(By.CSS_SELECTOR, '#btnLogin')
logon.click()
Attempt 3
service = Service(executable_path='../chromedriver.exe')
driver = webdriver.Chrome(service = service)
driver.get('https://advisorservices.schwab.com/')
driver.implicitly_wait(2)
user_id = driver.find_element(By.XPATH, '//*[@id="loginIdInput"]')
user_id.send_keys(web_username)
password = driver.find_element(By.XPATH, '//*[@id="passwordInput"]')
password.send_keys(web_password)
logon = driver.find_element(By.XPATH, '//*[@id="continueBtnText"]')
logon.click()