A password input (type=password).
driver.findElement(By.id("element_password")).sendKeys("secret");
# Python: driver.find_element(By.ID, "element_password").send_keys('secret')
// Java - Full Test
WebElement password = driver.findElement(By.id("element_password"));
password.clear();
password.sendKeys("secret");
assert password.getAttribute("type").equals("password");
assert password.getAttribute("value").equals("secret");
# Python - Full Test
password = driver.find_element(By.ID, "element_password")
password.clear()
password.send_keys("secret")
assert password.get_attribute("type") == "password"
assert password.get_attribute("value") == "secret"
// Java - Alternative Solution
WebElement el = driver.findElement(By.id("element_password"));
el.clear();
el.sendKeys("secret");
assert el.getAttribute("value").equals("secret");
# Python - Alternative Solution
el = driver.find_element(By.ID, "element_password")
el.clear()
el.send_keys("secret")
assert el.get_attribute("value") == "secret"
element_password.password.