Complete the code to find all elements with the class name "item".
List<WebElement> elements = driver.findElements(By.[1]("item"));
The findElements method with By.className locates all elements matching the given class.
Complete the code to check if any elements with the tag name "button" exist.
if (!driver.findElements(By.[1]("button")).isEmpty()) { System.out.println("Buttons found"); }
Using By.tagName finds all elements with the specified tag, here "button".
Fix the error in the code to correctly find all elements with the CSS selector ".active".
List<WebElement> activeElements = driver.[1](By.cssSelector(".active"));
findElements returns a list of all matching elements, while findElement returns only the first match.
Fill both blanks to create a list of elements with the name "option" and check if the list is empty.
List<WebElement> options = driver.[1](By.[2]("option")); if (options.isEmpty()) { System.out.println("No options found"); }
Use findElements to get all matching elements and By.name to locate by the "name" attribute.
Fill all three blanks to find all elements with the CSS class "menu-item", get their count, and print it.
List<WebElement> items = driver.[1](By.[2]("menu-item")); int count = items.[3](); System.out.println("Found " + count + " menu items.");
Use findElements to get all elements, By.className to locate by class, and size() to get the count.