SeleniumLab

Course1 · Selenium automation → Interactions

1 · Selenium automation

Typing and clicking

10 min · Module 8

Use send_keys to type and click to activate buttons/links. Clear fields first when reusing inputs.

Lab login uses your SeleniumLab account. After seeding, try demo / demo1234. A successful login redirects to /lab/welcome/.

Example / notes

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("http://127.0.0.1:8000/lab/login/")

driver.find_element(By.ID, "username").send_keys("demo")
driver.find_element(By.ID, "password").send_keys("demo1234")
driver.find_element(By.ID, "login-button").click()

assert "/lab/welcome/" in driver.current_url
success = driver.find_element(By.ID, "flash-success")
assert "Welcome" in success.text
driver.quit()

Practice in Lab: /lab/login/

Log in to track progress / take quizzes
Selects and checkboxes →
Modules in this track