Skip to content
Advertisement

Python Selenium: Inputting Email Address and Password and click Continue

I am using the following code to input Email address and password, by clicking the continue element.

However I have no idea should I enter driver.switch_to_frame and then webdriver can enter the email and password and click?

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options=Options()
options.chrome_executable=path="/Users/janice/Desktop/Algo/Selenium/chromedriver.exe"

driver=webdriver.Chrome(options=options)
driver.get("https://system.arthuronline.co.uk/genieliew1/dashboards/index")

Advertisement

Answer

It’s unclear what is the problem you faced with, why your code didn’t work.
Maybe you missind delay to wait for elments to be ready to accept input or click action?
Anyway, the following code works:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

options = Options()
options.add_argument("start-maximized")

webdriver_service = Service('C:webdriverschromedriver.exe')
driver = webdriver.Chrome(service=webdriver_service, options=options)

url = 'https://system.arthuronline.co.uk/genieliew1/dashboards/index'
driver.get(url)
wait = WebDriverWait(driver, 20)

wait.until(EC.element_to_be_clickable((By.ID, 'username'))).send_keys("the@email.com")
wait.until(EC.element_to_be_clickable((By.ID, 'password'))).send_keys("thepassword")
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button[type='submit']"))).click()

The result is:

enter image description here

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement