Complete the code to find an element using an absolute XPath.
WebElement element = driver.findElement(By.xpath("[1]"));
An absolute XPath starts from the root node and follows the full path.
Complete the code to find an element using a relative XPath.
WebElement element = driver.findElement(By.xpath("[1]"));
A relative XPath starts with '//' and finds elements anywhere in the document.
Fix the error in the XPath to correctly select the button with id 'login'.
WebElement loginButton = driver.findElement(By.xpath("[1]"));
The correct XPath uses '//' to search anywhere and '@' to specify attribute.
Fill both blanks to create a relative XPath that selects all div elements with class 'content'.
List<WebElement> divs = driver.findElements(By.xpath("[1][@class=[2]]"));
The XPath selects all div elements (//div) with class attribute equal to 'content' ([@class='content']).
Fill all three blanks to create an XPath that selects input elements with type 'text' inside a form with id 'searchForm'.
WebElement input = driver.findElement(By.xpath("[1][@id=[2]]//[3][@type='text']"));
The XPath selects a form element with id 'searchForm' and then finds input elements with type 'text' inside it.