Complete the code to locate the username input field by its ID.
username_input = driver.find_element(By.[1], "username")
By.name when the element has an ID.By.class_name which may select multiple elements.The By.id locator finds elements by their ID attribute, which is unique on the page.
Complete the code to locate the login button by its CSS selector.
login_button = driver.find_element(By.[1], ".btn-login")
By.xpath when CSS selector is given.By.link_text which is for links only.The By.CSS_SELECTOR locator finds elements using CSS selectors, which are flexible and powerful.
Fix the error in the locator to find the password input by name.
password_input = driver.find_element(By.[1], "password")
By.id when the element has no ID.By.class_name which may not be unique.The password input is located by its name attribute, so By.name is correct.
Fill both blanks to create a locator for a submit button with tag 'button' and class 'submit-btn'.
submit_button = driver.find_element(By.[1], "[2]")
By.css_selector with an XPath string.Using By.xpath with the XPath expression //button[contains(@class, 'submit-btn')] locates the button by tag and class.
Fill all three blanks to create a dictionary of locators for username, password, and login button.
locators = {
"username": (By.[1], "username"),
"password": (By.[2], "password"),
"login_button": (By.[3], ".btn-login")
}By.xpath unnecessarily.The username is located by ID, password by name, and login button by CSS selector, matching common attribute usage.