Complete the code to find an element by its ID using Selenium in Python.
element = driver.find_element(By.[1], "submit-button")
The By.ID selector targets elements by their unique ID attribute, ensuring precise selection.
Complete the code to find all elements with a specific class name.
elements = driver.find_elements(By.[1], "menu-item")
By.CLASS_NAME finds all elements with the given class, useful for multiple similar items.
Fix the error in the selector to correctly find a button with text 'Submit'.
button = driver.find_element(By.[1], "//button[text()='Submit']")
By.XPATH allows locating elements using path expressions, perfect for text matching.
Fill both blanks to create a reliable CSS selector for all buttons with class 'btn' inside a div with ID 'container'.
buttons = driver.find_elements(By.[1], "div#[2] button.btn")
Using By.CSS_SELECTOR with div#container button.btn selects all buttons with class 'btn' inside the div with ID 'container'.
Fill all three blanks to create a dictionary comprehension that maps input names to their values for inputs inside a form with ID 'login'.
inputs = driver.find_elements(By.[1], "form#login input") values = {input.get_attribute([2]): input.get_attribute([3]) for input in inputs}
Use By.CSS_SELECTOR to find inputs inside the form. Then get each input's name and value attributes to build the dictionary.