Complete the code to locate the username input field by its name attribute.
username_input = driver.find_element(By.[1], 'username')
The name attribute is commonly used to locate form fields like username inputs.
Complete the code to enter text into the password field.
password_input = driver.find_element(By.ID, 'password') password_input.[1]('mysecret')
Use send_keys to type text into input fields in Selenium.
Fix the error in the code to submit the form by clicking the submit button.
submit_button = driver.find_element(By.CSS_SELECTOR, 'button[type=[1]]') submit_button.click()
The CSS selector should target button[type='submit'] to find the submit button.
Fill both blanks to check if the form submission was successful by verifying the success message text.
success_message = driver.find_element(By.CLASS_NAME, '[1]') assert '[2]' in success_message.text
The success message usually has a class like 'success' and contains text like 'Welcome' after form submission.
Fill all three blanks to create a dictionary of form data and fill the username field using Selenium.
form_data = {'username': '[1]', 'password': '[2]'}
username_input = driver.find_element(By.NAME, 'username')
username_input.send_keys(form_data['[3]'])We create a dictionary of form data {'username': 'user1', 'password': 'pass123'} and use it to fill the username field.