Complete the code to find an element using an absolute XPath.
element = driver.find_element(By.XPATH, '[1]')
The absolute XPath starts from the root /html and goes down the full path.
Complete the code to find an element using a relative XPath.
element = driver.find_element(By.XPATH, '[1]')
The relative XPath starts with '//' and finds elements anywhere in the document matching the condition.
Fix the error in the XPath expression to select a button with class 'submit'.
button = driver.find_element(By.XPATH, '[1]')
The correct XPath uses '@' to specify an attribute: //button[@class='submit'].
Fill both blanks to create a relative XPath that selects all <li> elements inside a <ul> with id 'menu'.
items = driver.find_elements(By.XPATH, '[1]/li[2]')
The XPath //ul[@id='menu']/li selects all <li> children of the <ul> with id 'menu'. The second blank is empty because no extra predicate is needed.
Fill all three blanks to create a relative XPath that selects the first <input> element with type 'text' inside a form with class 'login'.
input_element = driver.find_element(By.XPATH, '[1][2][3]')
The XPath //form[contains(@class, 'login')]//input[@type='text'][1] selects the first <input> with type 'text' inside the form with class 'login'.