Complete the code to define an action method that clicks a button.
def click_submit(self): self.driver.find_element(By.ID, 'submit').[1]()
The click() method simulates a mouse click on the button element.
Complete the code to enter text into a search input field.
def enter_search_text(self, text): search_box = self.driver.find_element(By.NAME, 'q') search_box.[1](text)
The send_keys() method types the given text into the input field.
Fix the error in the method that clears and types text into an input field.
def update_username(self, username): input_field = self.driver.find_element(By.ID, 'username') input_field.[1]() input_field.send_keys(username)
The clear() method removes any existing text before typing new text.
Fill both blanks to create a method that selects a checkbox if it is not already selected.
def select_checkbox(self): checkbox = self.driver.find_element(By.CSS_SELECTOR, '#agree') if not checkbox.[1]: checkbox.[2]()
is_selected checks if the checkbox is checked. If not, click() selects it.
Fill all three blanks to define a method that submits a form after entering email and password.
def login(self, email, password): self.driver.find_element(By.ID, [1]).send_keys(email) self.driver.find_element(By.ID, [2]).send_keys(password) self.driver.find_element(By.ID, [3]).click()
The method fills the email and password fields by their IDs and clicks the submit button.
